Show More
@@ -284,10 +284,24 b' def sendrequest(ui, opener, req):' | |||||
284 |
|
284 | |||
285 | start = util.timer() |
|
285 | start = util.timer() | |
286 |
|
286 | |||
287 | res = opener.open(req) |
|
287 | try: | |
288 | if ui.configbool('devel', 'debug.peer-request'): |
|
288 | res = opener.open(req) | |
289 | dbg(line % ' finished in %.4f seconds (%s)' |
|
289 | except urlerr.httperror as inst: | |
290 | % (util.timer() - start, res.code)) |
|
290 | if inst.code == 401: | |
|
291 | raise error.Abort(_('authorization failed')) | |||
|
292 | raise | |||
|
293 | except httplib.HTTPException as inst: | |||
|
294 | ui.debug('http error requesting %s\n' % | |||
|
295 | util.hidepassword(req.get_full_url())) | |||
|
296 | ui.traceback() | |||
|
297 | raise IOError(None, inst) | |||
|
298 | finally: | |||
|
299 | if ui.configbool('devel', 'debug.peer-request'): | |||
|
300 | dbg(line % ' finished in %.4f seconds (%s)' | |||
|
301 | % (util.timer() - start, res.code)) | |||
|
302 | ||||
|
303 | # Insert error handlers for common I/O failures. | |||
|
304 | _wraphttpresponse(res) | |||
291 |
|
305 | |||
292 | return res |
|
306 | return res | |
293 |
|
307 | |||
@@ -346,19 +360,7 b' class httppeer(wireproto.wirepeer):' | |||||
346 | self._caps, self.capable, |
|
360 | self._caps, self.capable, | |
347 | self._url, cmd, args) |
|
361 | self._url, cmd, args) | |
348 |
|
362 | |||
349 | try: |
|
363 | resp = sendrequest(self.ui, self._urlopener, req) | |
350 | resp = sendrequest(self.ui, self._urlopener, req) |
|
|||
351 | except urlerr.httperror as inst: |
|
|||
352 | if inst.code == 401: |
|
|||
353 | raise error.Abort(_('authorization failed')) |
|
|||
354 | raise |
|
|||
355 | except httplib.HTTPException as inst: |
|
|||
356 | self.ui.debug('http error while sending %s command\n' % cmd) |
|
|||
357 | self.ui.traceback() |
|
|||
358 | raise IOError(None, inst) |
|
|||
359 |
|
||||
360 | # Insert error handlers for common I/O failures. |
|
|||
361 | _wraphttpresponse(resp) |
|
|||
362 |
|
364 | |||
363 | # record the url we got redirected to |
|
365 | # record the url we got redirected to | |
364 | resp_url = pycompat.bytesurl(resp.geturl()) |
|
366 | resp_url = pycompat.bytesurl(resp.geturl()) |
General Comments 0
You need to be logged in to leave comments.
Login now