Details
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHGe10b695b9c41: httppeer: fix debug prints to work on Python 3
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
indygreg |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/httppeer.py (5 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 |
"""Send a prepared HTTP request. | """Send a prepared HTTP request. | ||||
Returns the response object. | Returns the response object. | ||||
""" | """ | ||||
if (ui.debugflag | if (ui.debugflag | ||||
and ui.configbool('devel', 'debug.peer-request')): | and ui.configbool('devel', 'debug.peer-request')): | ||||
dbg = ui.debug | dbg = ui.debug | ||||
line = 'devel-peer-request: %s\n' | line = 'devel-peer-request: %s\n' | ||||
dbg(line % '%s %s' % (req.get_method(), req.get_full_url())) | dbg(line % '%s %s' % (pycompat.bytesurl(req.get_method()), | ||||
pycompat.bytesurl(req.get_full_url()))) | |||||
hgargssize = None | hgargssize = None | ||||
for header, value in sorted(req.header_items()): | for header, value in sorted(req.header_items()): | ||||
if header.startswith('X-hgarg-'): | if header.startswith('X-hgarg-'): | ||||
if hgargssize is None: | if hgargssize is None: | ||||
hgargssize = 0 | hgargssize = 0 | ||||
hgargssize += len(value) | hgargssize += len(value) | ||||
else: | else: | ||||
raise | raise | ||||
except httplib.HTTPException as inst: | except httplib.HTTPException as inst: | ||||
ui.debug('http error requesting %s\n' % | ui.debug('http error requesting %s\n' % | ||||
util.hidepassword(req.get_full_url())) | util.hidepassword(req.get_full_url())) | ||||
ui.traceback() | ui.traceback() | ||||
raise IOError(None, inst) | raise IOError(None, inst) | ||||
finally: | finally: | ||||
if ui.configbool('devel', 'debug.peer-request'): | if ui.configbool('devel', 'debug.peer-request'): | ||||
dbg(line % ' finished in %.4f seconds (%s)' | dbg(line % ' finished in %.4f seconds (%d)' | ||||
% (util.timer() - start, res.code)) | % (util.timer() - start, res.code)) | ||||
# Insert error handlers for common I/O failures. | # Insert error handlers for common I/O failures. | ||||
_wraphttpresponse(res) | _wraphttpresponse(res) | ||||
return res | return res | ||||
def parsev1commandresponse(ui, baseurl, requrl, qs, resp, compressible, | def parsev1commandresponse(ui, baseurl, requrl, qs, resp, compressible, |