[0.14] bzrlib.errors.TransportError: Transport error: Server refuses to fullfil the request
v.ladeuil+lp at free.fr
Sun Feb 11 14:49:59 GMT 2007
>>>>> "john" == John Arbash Meinel <john at arbash-meinel.com> writes:
john> Jari Aalto wrote:
>> I'm having a problem pulling from my own HTTP server. Deteils below.
>> - Could the error message be a little more verbose. Like printing
>> possible reasons for and suggest actions to check.
>> In the server size all files and firs are drwxr-xr-x, I've also
>> restarted apache2 but this doesn't affect the error. Perhaps this is
>> an error in my side, just can't read it from the error.
john> I agree it should describe what is going on. You are getting a 403 error.
john> Try the attached patch. I think I also found a bug in the 404 handler
john> (it was directly using HTTPError, but I couldn't find that imported
john> anywhere. Which surprises me a lot, because we do quite a few NoSuchFile
You found a bug, but it's dead code, see below.
john> === modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
john> --- bzrlib/transport/http/_urllib2_wrappers.py 2006-12-13 15:08:39 +0000
john> +++ bzrlib/transport/http/_urllib2_wrappers.py 2007-02-11 13:43:48 +0000
john> @@ -761,16 +761,19 @@
john> def http_error_default(self, req, fp, code, msg, hdrs):
john> if code == 404:
john> raise errors.NoSuchFile(req.get_selector(),
john> - extra=HTTPError(req.get_full_url(),
john> - code, msg,
john> - hdrs, fp))
john> + extra=urllib2.HTTPError(req.get_full_url(),
john> + code, msg,
john> + hdrs, fp))
This is dead code, the 404 code is filtered just above in
HTTPErrorProcessor.http_response (it's a bit hard to read because
it uses the call chains from urllib2: the self.parent.error will
end calling HTTPDefaultErrorHandler.http_error_default.
404 is not considered an error for urllib because we want to be
able to translate it into NoSuchFile, but not here.
So it can be safely deleted.
john> elif code == 403:
john> - raise errors.TransportError('Server refuses to fullfil the request')
john> + raise errors.TransportError(
john> + 'Server refuses to fullfil the request for url %s'
john> + ' (code: %s, msg: %s, headers: %s)'
john> + % (req.get_full_url(), code, msg, hdrs))
john> elif code == 416:
john> # We don't know which, but one of the ranges we
john> # specified was wrong. So we raise with 0 for a lack
john> # of a better magic value.
john> - raise errors.InvalidRange(req.get_full_url(),0)
john> + raise errors.InvalidRange(req.get_full_url(), 0)
john> # TODO: A test is needed to exercise that code path
john> raise errors.InvalidHttpResponse(req.get_full_url(),
+1 to merge that.
More information about the bazaar