~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2008-05-18 13:59:54 UTC
  • mto: (3431.2.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 3433.
  • Revision ID: v.ladeuil+lp@free.fr-20080518135954-o8v3f69soqztpg0f
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.

Show diffs side-by-side

added added

removed removed

Lines of Context:
133
133
 
134
134
    def _post(self, body_bytes):
135
135
        abspath = self._remote_path('.bzr/smart')
136
 
        response = self._perform(Request('POST', abspath, body_bytes))
 
136
        response = self._perform(Request('POST', abspath, body_bytes,
 
137
                                         accepted_errors=[200, 403]))
137
138
        code = response.code
 
139
        if code == 403:
 
140
            raise errors.SmartProtocolError(
 
141
                'Server refuses to fulfill the request (403 Forbidden)'
 
142
                ' for %s' % abspath)
138
143
        data = handle_response(abspath, code, response.info(), response)
139
144
        return code, data
140
145