~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2006-07-18 20:27:50 UTC
  • mto: This revision was merged to the branch mainline in revision 1869.
  • Revision ID: john@arbash-meinel.com-20060718202750-0ecae2405c7a7b55
code cleanups from Martin Pool.

Show diffs side-by-side

added added

removed removed

Lines of Context:
152
152
        if code == 404:
153
153
            raise NoSuchFile(abspath)
154
154
        if code != 200:
155
 
            raise errors.InvalidHttpResponse(abspath,
156
 
                'Expected a 200 or 404 response, not: %s' % code)
 
155
            self._raise_curl_http_error(curl, 'expected 200 or 404 for full response.')
157
156
 
158
157
        return code, data
159
158
 
185
184
        raise ConnectionError('curl connection error (%s) on %s'
186
185
                              % (os.strerror(curl_errno), url))
187
186
 
188
 
    def _raise_curl_http_error(self, curl):
 
187
    def _raise_curl_http_error(self, curl, info=None):
189
188
        code = curl.getinfo(pycurl.HTTP_CODE)
190
189
        url = curl.getinfo(pycurl.EFFECTIVE_URL)
191
 
        raise errors.InvalidHttpResponse(url, 'http error code %d' % (code,))
 
190
        if info is None:
 
191
            msg = ''
 
192
        else:
 
193
            msg = ': ' + info
 
194
        raise errors.InvalidHttpResponse(url, 'Unable to handle http code %d%s'
 
195
                                              % (code,msg))
192
196
 
193
197
    def _set_curl_options(self, curl):
194
198
        """Set options for all requests"""