Rev 3666: (vila) Really fix bug #225020 by catching CURLE_SEND_ERROR unconditionally in http://bazaar.launchpad.net/%7Evila/bzr/bzr.integration

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri Aug 29 20:41:50 BST 2008


At http://bazaar.launchpad.net/%7Evila/bzr/bzr.integration

------------------------------------------------------------
revno: 3666
revision-id: v.ladeuil+lp at free.fr-20080829194041-2uefiin1bbiff91k
parent: pqm at pqm.ubuntu.com-20080829062746-ny482m2f2pukdhqt
parent: v.ladeuil+lp at free.fr-20080829074035-b27ccuxuzgb6rba1
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: trunk
timestamp: Fri 2008-08-29 21:40:41 +0200
message:
  (vila) Really fix bug #225020 by catching CURLE_SEND_ERROR unconditionally
modified:
  bzrlib/transport/http/_pycurl.py pycurlhttp.py-20060110060940-4e2a705911af77a6
    ------------------------------------------------------------
    revno: 3651.1.2
    revision-id: v.ladeuil+lp at free.fr-20080829074035-b27ccuxuzgb6rba1
    parent: v.ladeuil+lp at free.fr-20080827202611-8l16umo6ylc4rbnw
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: 225020-select-poll
    timestamp: Fri 2008-08-29 09:40:35 +0200
    message:
      Fix bug #225020 by catching the CURLE_SEND_ERROR error more broadly.
      
      * bzrlib/transport/http/_pycurl.py:
      (PyCurlTransport._post): Other error codes than 403 can trigger
      the bug. Catching the CURLE_SEND_ERROR should not be restricted.
    modified:
      bzrlib/transport/http/_pycurl.py pycurlhttp.py-20060110060940-4e2a705911af77a6
-------------- next part --------------
=== modified file 'bzrlib/transport/http/_pycurl.py'
--- a/bzrlib/transport/http/_pycurl.py	2008-08-27 20:26:11 +0000
+++ b/bzrlib/transport/http/_pycurl.py	2008-08-29 07:40:35 +0000
@@ -267,17 +267,20 @@
             self._curl_perform(curl, header, ['Expect: '])
         except pycurl.error, e:
             if e[0] == CURLE_SEND_ERROR:
-                # This has been observed when curl assumes a closed connection
-                # when talking to HTTP/1.0 servers, getting a 403, but trying
-                # to send the request body anyway. (see bug #225020)
-                code = curl.getinfo(pycurl.HTTP_CODE)
-                if code == 403:
-                    raise errors.InvalidHttpResponse(
-                        abspath,
-                        'Unexpected send error,'
-                        ' the server probably closed the connection')
-            # Re-raise otherwise
-            raise
+                # When talking to an HTTP/1.0 server, getting a 400+ error code
+                # triggers a bug in some combinations of curl/kernel in rare
+                # occurrences. Basically, the server closes the connection
+                # after sending the error but the client (having received and
+                # parsed the response) still try to send the request body (see
+                # bug #225020 and its upstream associated bug).  Since the
+                # error code and the headers are known to be available, we just
+                # swallow the exception, leaving the upper levels handle the
+                # 400+ error.
+                mutter('got pycurl error in POST: %s, %s, %s, url: %s ',
+                       e[0], e[1], e, abspath)
+            else:
+                # Re-raise otherwise
+                raise
         data.seek(0)
         code = curl.getinfo(pycurl.HTTP_CODE)
         msg = self._parse_headers(header)



More information about the bazaar-commits mailing list