Rev 3653: Fix bug #225020 by catching the CURLE_SEND_ERROR error more broadly. in lp:~vila/bzr/225020-select-poll
Vincent Ladeuil
v.ladeuil+lp at free.fr
Fri Aug 29 08:40:42 BST 2008
At lp:~vila/bzr/225020-select-poll
------------------------------------------------------------
revno: 3653
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