Details
Details
- Reviewers
yuja - Group Reviewers
hg-reviewers - Commits
- rHGa288712d86d5: httppeer: extract content-type from headers using native str
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
| yuja |
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| resp_url = pycompat.bytesurl(resp.geturl()) | resp_url = pycompat.bytesurl(resp.geturl()) | ||||
| if resp_url.endswith(qs): | if resp_url.endswith(qs): | ||||
| resp_url = resp_url[:-len(qs)] | resp_url = resp_url[:-len(qs)] | ||||
| if self._url.rstrip('/') != resp_url.rstrip('/'): | if self._url.rstrip('/') != resp_url.rstrip('/'): | ||||
| if not self.ui.quiet: | if not self.ui.quiet: | ||||
| self.ui.warn(_('real URL is %s\n') % resp_url) | self.ui.warn(_('real URL is %s\n') % resp_url) | ||||
| self._url = resp_url | self._url = resp_url | ||||
| try: | try: | ||||
| proto = resp.getheader('content-type') | proto = pycompat.bytesurl(resp.getheader(r'content-type', r'')) | ||||
| except AttributeError: | except AttributeError: | ||||
| proto = resp.headers.get('content-type', '') | proto = pycompat.bytesurl(resp.headers.get(r'content-type', r'')) | ||||
| safeurl = util.hidepassword(self._url) | safeurl = util.hidepassword(self._url) | ||||
| if proto.startswith('application/hg-error'): | if proto.startswith('application/hg-error'): | ||||
| raise error.OutOfBandError(resp.read()) | raise error.OutOfBandError(resp.read()) | ||||
| # accept old "text/plain" and "application/hg-changegroup" for now | # accept old "text/plain" and "application/hg-changegroup" for now | ||||
| if not (proto.startswith('application/mercurial-') or | if not (proto.startswith('application/mercurial-') or | ||||
| (proto.startswith('text/plain') | (proto.startswith('text/plain') | ||||
| and not resp.headers.get('content-length')) or | and not resp.headers.get('content-length')) or | ||||