Rev 2965: Fix #160012 by leaving the http pipeline related exceptions raise in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Nov 5 14:33:53 GMT 2007


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 2965
revision-id: pqm at pqm.ubuntu.com-20071105143350-4ci30x2493vaeb3q
parent: pqm at pqm.ubuntu.com-20071104235617-jz5b1yxe61q2jjfp
parent: v.ladeuil+lp at free.fr-20071105132130-es2vb5ltorlgvoh2
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2007-11-05 14:33:50 +0000
message:
  Fix #160012 by leaving the http pipeline related exceptions raise
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
    ------------------------------------------------------------
    revno: 2964.1.1
    merged: v.ladeuil+lp at free.fr-20071105132130-es2vb5ltorlgvoh2
    parent: pqm at pqm.ubuntu.com-20071104235617-jz5b1yxe61q2jjfp
    parent: v.ladeuil+lp at free.fr-20071104175530-f5ultnhecixj0ntx
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: trunk
    timestamp: Mon 2007-11-05 14:21:30 +0100
    message:
      Fix #160012 by leaving the http pipeline related exceptions raise
    ------------------------------------------------------------
    revno: 2955.2.1
    merged: 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 file 'NEWS'
--- a/NEWS	2007-11-04 15:29:17 +0000
+++ b/NEWS	2007-11-05 13:21:30 +0000
@@ -132,7 +132,11 @@
      display a user friendly message instead of a traceback.
      (Ian Clatworthy, #115601)
 
-   * Do no use timeout in HttpServer anymore.
+   * 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)
+
+   * Don't use timeout in HttpServer anymore.
      (Vincent Ladeuil, #158972).
 
    * Make sure to use ``O_BINARY`` when opening files to check their

=== modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
--- a/bzrlib/transport/http/_urllib2_wrappers.py	2007-10-23 10:58:09 +0000
+++ b/bzrlib/transport/http/_urllib2_wrappers.py	2007-11-05 13:21:30 +0000
@@ -109,7 +109,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
 
 
@@ -353,6 +358,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:
@@ -382,22 +391,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