changeset 39445:cdb56f295b03

httppeer: use our CBOR decoder We just implemented our own CBOR decoder. Let's use it in httppeer. Differential Revision: https://phab.mercurial-scm.org/D4465
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 28 Aug 2018 15:10:56 -0700
parents 45d12c49c3f3
children 36f487a332ad
files mercurial/httppeer.py
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/httppeer.py	Wed Aug 22 09:02:07 2018 +0800
+++ b/mercurial/httppeer.py	Tue Aug 28 15:10:56 2018 -0700
@@ -16,9 +16,6 @@
 import weakref
 
 from .i18n import _
-from .thirdparty import (
-    cbor,
-)
 from . import (
     bundle2,
     error,
@@ -35,6 +32,7 @@
     wireprotov2server,
 )
 from .utils import (
+    cborutil,
     interfaceutil,
     stringutil,
 )
@@ -913,8 +911,8 @@
     if advertisev2:
         if ct == 'application/mercurial-cbor':
             try:
-                info = cbor.loads(rawdata)
-            except cbor.CBORDecodeError:
+                info = cborutil.decodeall(rawdata)[0]
+            except cborutil.CBORDecodeError:
                 raise error.Abort(_('error decoding CBOR from remote server'),
                                   hint=_('try again and consider contacting '
                                          'the server operator'))