303 raise error.Abort(_(b'authorization failed')) |
304 raise error.Abort(_(b'authorization failed')) |
304 raise |
305 raise |
305 except httplib.HTTPException as inst: |
306 except httplib.HTTPException as inst: |
306 ui.debug( |
307 ui.debug( |
307 b'http error requesting %s\n' |
308 b'http error requesting %s\n' |
308 % util.hidepassword(req.get_full_url()) |
309 % urlutil.hidepassword(req.get_full_url()) |
309 ) |
310 ) |
310 ui.traceback() |
311 ui.traceback() |
311 raise IOError(None, inst) |
312 raise IOError(None, inst) |
312 finally: |
313 finally: |
313 if ui.debugflag and ui.configbool(b'devel', b'debug.peer-request'): |
314 if ui.debugflag and ui.configbool(b'devel', b'debug.peer-request'): |
350 try: |
351 try: |
351 proto = pycompat.bytesurl(resp.getheader('content-type', '')) |
352 proto = pycompat.bytesurl(resp.getheader('content-type', '')) |
352 except AttributeError: |
353 except AttributeError: |
353 proto = pycompat.bytesurl(resp.headers.get('content-type', '')) |
354 proto = pycompat.bytesurl(resp.headers.get('content-type', '')) |
354 |
355 |
355 safeurl = util.hidepassword(baseurl) |
356 safeurl = urlutil.hidepassword(baseurl) |
356 if proto.startswith(b'application/hg-error'): |
357 if proto.startswith(b'application/hg-error'): |
357 raise error.OutOfBandError(resp.read()) |
358 raise error.OutOfBandError(resp.read()) |
358 |
359 |
359 # Pre 1.0 versions of Mercurial used text/plain and |
360 # Pre 1.0 versions of Mercurial used text/plain and |
360 # application/hg-changegroup. We don't support such old servers. |
361 # application/hg-changegroup. We don't support such old servers. |
361 if not proto.startswith(b'application/mercurial-'): |
362 if not proto.startswith(b'application/mercurial-'): |
362 ui.debug(b"requested URL: '%s'\n" % util.hidepassword(requrl)) |
363 ui.debug(b"requested URL: '%s'\n" % urlutil.hidepassword(requrl)) |
363 msg = _( |
364 msg = _( |
364 b"'%s' does not appear to be an hg repository:\n" |
365 b"'%s' does not appear to be an hg repository:\n" |
365 b"---%%<--- (%s)\n%s\n---%%<---\n" |
366 b"---%%<--- (%s)\n%s\n---%%<---\n" |
366 ) % (safeurl, proto or b'no content-type', resp.read(1024)) |
367 ) % (safeurl, proto or b'no content-type', resp.read(1024)) |
367 |
368 |
1056 connections, perform HTTP requests. |
1057 connections, perform HTTP requests. |
1057 |
1058 |
1058 ``requestbuilder`` is the type used for constructing HTTP requests. |
1059 ``requestbuilder`` is the type used for constructing HTTP requests. |
1059 It exists as an argument so extensions can override the default. |
1060 It exists as an argument so extensions can override the default. |
1060 """ |
1061 """ |
1061 u = util.url(path) |
1062 u = urlutil.url(path) |
1062 if u.query or u.fragment: |
1063 if u.query or u.fragment: |
1063 raise error.Abort( |
1064 raise error.Abort( |
1064 _(b'unsupported URL component: "%s"') % (u.query or u.fragment) |
1065 _(b'unsupported URL component: "%s"') % (u.query or u.fragment) |
1065 ) |
1066 ) |
1066 |
1067 |