Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/httppeer.py @ 34725:a288712d86d5
httppeer: extract content-type from headers using native str
Differential Revision: https://phab.mercurial-scm.org/D1090
author | Augie Fackler <augie@google.com> |
---|---|
date | Sat, 14 Oct 2017 12:00:35 -0400 |
parents | 9c3dcaf648ef |
children | 67e9678efd98 |
comparison
equal
deleted
inserted
replaced
34724:9c3dcaf648ef | 34725:a288712d86d5 |
---|---|
309 if self._url.rstrip('/') != resp_url.rstrip('/'): | 309 if self._url.rstrip('/') != resp_url.rstrip('/'): |
310 if not self.ui.quiet: | 310 if not self.ui.quiet: |
311 self.ui.warn(_('real URL is %s\n') % resp_url) | 311 self.ui.warn(_('real URL is %s\n') % resp_url) |
312 self._url = resp_url | 312 self._url = resp_url |
313 try: | 313 try: |
314 proto = resp.getheader('content-type') | 314 proto = pycompat.bytesurl(resp.getheader(r'content-type', r'')) |
315 except AttributeError: | 315 except AttributeError: |
316 proto = resp.headers.get('content-type', '') | 316 proto = pycompat.bytesurl(resp.headers.get(r'content-type', r'')) |
317 | 317 |
318 safeurl = util.hidepassword(self._url) | 318 safeurl = util.hidepassword(self._url) |
319 if proto.startswith('application/hg-error'): | 319 if proto.startswith('application/hg-error'): |
320 raise error.OutOfBandError(resp.read()) | 320 raise error.OutOfBandError(resp.read()) |
321 # accept old "text/plain" and "application/hg-changegroup" for now | 321 # accept old "text/plain" and "application/hg-changegroup" for now |