D1090: httppeer: extract content-type from headers using native str

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Sun Oct 15 04:58:02 UTC 2017


durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1090

AFFECTED FILES
  mercurial/httppeer.py

CHANGE DETAILS

diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -311,9 +311,9 @@
                 self.ui.warn(_('real URL is %s\n') % resp_url)
         self._url = resp_url
         try:
-            proto = resp.getheader('content-type')
+            proto = pycompat.bytesurl(resp.getheader(r'content-type', r''))
         except AttributeError:
-            proto = resp.headers.get('content-type', '')
+            proto = pycompat.bytesurl(resp.headers.get(r'content-type', r''))
 
         safeurl = util.hidepassword(self._url)
         if proto.startswith('application/hg-error'):



To: durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list