Rev 3431: Fix #230223 by making both http implementations raise appropriate exceptions. in http://bazaar.launchpad.net/~vila/bzr/230223-hpss-probing
Vincent Ladeuil
v.ladeuil+lp at free.fr
Sun May 18 15:00:03 BST 2008
At http://bazaar.launchpad.net/~vila/bzr/230223-hpss-probing
------------------------------------------------------------
revno: 3431
revision-id: v.ladeuil+lp at free.fr-20080518135954-o8v3f69soqztpg0f
parent: pqm at pqm.ubuntu.com-20080517004133-6476aqcg9uf8zn0c
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 230223-hpss-probing
timestamp: Sun 2008-05-18 15:59:54 +0200
message:
Fix #230223 by making both http implementations raise appropriate exceptions.
* _urllib2_wrappers.py:
(HTTPDefaultErrorHandler.http_error_default): Fix the spelling
error and also mentioned the url.
* _urllib.py:
(HttpTransport_urllib._post): Since the error handling differs from
pycurl and we are used only by the smart client, treats 403 as a
SmartProtocolError,
* _pycurl.py:
(PyCurlTransport._raise_curl_http_error): Fix the spelling error and
also mentioned the url.
modified:
bzrlib/transport/http/_pycurl.py pycurlhttp.py-20060110060940-4e2a705911af77a6
bzrlib/transport/http/_urllib.py _urlgrabber.py-20060113083826-0bbf7d992fbf090c
bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
-------------- next part --------------
=== modified file 'bzrlib/transport/http/_pycurl.py'
--- a/bzrlib/transport/http/_pycurl.py 2007-12-20 16:36:44 +0000
+++ b/bzrlib/transport/http/_pycurl.py 2008-05-18 13:59:54 +0000
@@ -278,7 +278,8 @@
# requests
if code == 403:
raise errors.TransportError(
- 'Server refuses to fullfil the request for: %s' % url)
+ 'Server refuses to fulfill the request (403 Forbidden)'
+ ' for %s' % url)
else:
if info is None:
msg = ''
=== modified file 'bzrlib/transport/http/_urllib.py'
--- a/bzrlib/transport/http/_urllib.py 2008-03-05 15:48:27 +0000
+++ b/bzrlib/transport/http/_urllib.py 2008-05-18 13:59:54 +0000
@@ -133,8 +133,13 @@
def _post(self, body_bytes):
abspath = self._remote_path('.bzr/smart')
- response = self._perform(Request('POST', abspath, body_bytes))
+ response = self._perform(Request('POST', abspath, body_bytes,
+ accepted_errors=[200, 403]))
code = response.code
+ if code == 403:
+ raise errors.SmartProtocolError(
+ 'Server refuses to fulfill the request (403 Forbidden)'
+ ' for %s' % abspath)
data = handle_response(abspath, code, response.info(), response)
return code, data
=== modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
--- a/bzrlib/transport/http/_urllib2_wrappers.py 2008-04-24 07:22:53 +0000
+++ b/bzrlib/transport/http/_urllib2_wrappers.py 2008-05-18 13:59:54 +0000
@@ -1334,7 +1334,9 @@
def http_error_default(self, req, fp, code, msg, hdrs):
if code == 403:
- raise errors.TransportError('Server refuses to fullfil the request')
+ raise errors.TransportError(
+ 'Server refuses to fulfill the request (403 Forbidden)'
+ ' for %s' % req.get_full_url())
else:
raise errors.InvalidHttpResponse(req.get_full_url(),
'Unable to handle http code %d: %s'
More information about the bazaar-commits
mailing list