Rev 2956: Fix #160012 by leaving the http pipeline related exceptions raise. in file:///v/home/vila/src/bzr/bugs/160012/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Sun Nov 4 17:55:31 GMT 2007
At file:///v/home/vila/src/bzr/bugs/160012/
------------------------------------------------------------
revno: 2956
revision-id:v.ladeuil+lp at free.fr-20071104175530-f5ultnhecixj0ntx
parent: pqm at pqm.ubuntu.com-20071031141102-b5664t8izotfnc6h
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 160012
timestamp: Sun 2007-11-04 18:55:30 +0100
message:
Fix #160012 by leaving the http pipeline related exceptions raise.
* bzrlib/transport/http/_urllib2_wrappers.py:
(AbstractHTTPHandler.retry_or_raise): Don't retry if the exception
is about the http piepeline status or some programming errors will
be hidden (retrying clean the pipe left dirty by the *previous*
request).
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2007-10-31 09:46:42 +0000
+++ b/NEWS 2007-11-04 17:55:30 +0000
@@ -127,6 +127,10 @@
display a user friendly message instead of a traceback.
(Ian Clatworthy, #115601)
+ * Don't catch the exceptions related to the http pipeline status before
+ retrying an http request or some programming errors may be masked.
+ (Vincent Ladeuil, #160012)
+
* Make sure to use ``O_BINARY`` when opening files to check their
sha1sum. (Alexander Belchenko, John Arbash Meinel, #153493)
=== modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
--- a/bzrlib/transport/http/_urllib2_wrappers.py 2007-07-04 12:28:56 +0000
+++ b/bzrlib/transport/http/_urllib2_wrappers.py 2007-11-04 17:55:30 +0000
@@ -113,7 +113,12 @@
# close the connection. Some cases are not correctly detected by
# httplib.HTTPConnection.getresponse (called by
# httplib.HTTPResponse.begin). The CONNECT response for the https
- # through proxy case is one.
+ # through proxy case is one. Note: the 'will_close' below refers
+ # to the "true" socket between us and the server, whereas the
+ # 'close()' above refers to the copy of that socket created by
+ # httplib for the response itself. So, in the if above we close the
+ # socket to indicate that we are done with the response whereas
+ # below we keep the socket with the server opened.
self.will_close = False
@@ -405,6 +410,10 @@
raise errors.ConnectionError("Couldn't resolve host '%s'"
% request.get_origin_req_host(),
orig_error=exc_val)
+ elif isinstance(exc_val, httplib.ImproperConnectionState):
+ # The httplib pipeline is in incorrect state, it's a bug in our
+ # implementation.
+ raise exc_type, exc_val, exc_tb
else:
if first_try:
if self._debuglevel > 0:
@@ -434,22 +443,11 @@
else:
# All other exception are considered connection related.
- # httplib.HTTPException should indicate a bug in our
- # urllib-based implementation, somewhow the httplib
- # pipeline is in an incorrect state, we retry in hope that
- # this will correct the problem but that may need
- # investigation (note that no such bug is known as of
- # 20061005 --vila).
-
# socket errors generally occurs for reasons
# far outside our scope, so closing the
# connection and retrying is the best we can
# do.
- # FIXME: and then there is HTTPError raised by:
- # - HTTPDefaultErrorHandler (we define our own)
- # - HTTPRedirectHandler.redirect_request
-
my_exception = errors.ConnectionError(
msg= 'while sending %s %s:' % (request.get_method(),
request.get_selector()),
More information about the bazaar-commits
mailing list