~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/http/_pycurl.py

  • Committer: Vincent Ladeuil
  • Date: 2009-08-19 16:33:39 UTC
  • mto: (4630.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4631.
  • Revision ID: v.ladeuil+lp@free.fr-20090819163339-80g9c3lad00wpe0v
More complete fix.

* bzrlib/transport/http/_urllib2_wrappers.py:
(AbstractHTTPHandler.retry_or_raise): ECONNRESET should be
translated into ConnectionReset. It's pretty rare that it can
occur during the request sending, but it has been observed during
selftest runs.

* bzrlib/transport/http/_pycurl.py:
(PyCurlTransport._curl_perform): Turns CURLE_RECV_ERROR into a
ConnectionReset instead of a ConnectionError or some callers won't
catch it properly.

* bzrlib/transport/http/__init__.py:
(SmartClientHTTPMedium.send_http_smart_request): Catch
ConnectionReset and turn into a SmartProtocolError like for
InvalidHttpResponse.

* bzrlib/tests/test_http.py:
(TestWallServer.test_http_has, TestWallServer.test_http_get):
ConnectionReset can be raised too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
363
363
                        CURLE_COULDNT_RESOLVE_PROXY,
364
364
                        CURLE_COULDNT_CONNECT,
365
365
                        CURLE_GOT_NOTHING,
366
 
                        CURLE_RECV_ERROR,
367
366
                        CURLE_SSL_CACERT,
368
367
                        CURLE_SSL_CACERT_BADFILE,
369
368
                        ):
370
369
                raise errors.ConnectionError(
371
370
                    'curl connection error (%s)\non %s' % (e[1], url))
 
371
            elif e[0] == CURLE_RECV_ERROR:
 
372
                raise errors.ConnectionReset(
 
373
                    'curl connection error (%s)\non %s' % (e[1], url))
372
374
            elif e[0] == CURLE_PARTIAL_FILE:
373
375
                # Pycurl itself has detected a short read.  We do not have all
374
376
                # the information for the ShortReadvError, but that should be