[MERGE][bug #230223] Make both http implementations raise appropriate exceptions on 403 Forbidden
Andrew Bennetts
andrew at canonical.com
Tue May 20 03:32:44 BST 2008
Martin Pool wrote:
> >> --- bzrlib/transport/http/_pycurl.py 2007-12-20 16:36:44 +0000
> >> +++ 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)
> >
> > Good idea.
>
> Maybe we should show the 'reason phrase' (the bit following the
> numeric status) rather than assuming/implying it's just 'Forbidden'?
> I realize it generally will be that, but it can be easier to debug
> connection problems if the client shows what it can...
Yeah. Although the HTTP server might be using a different language to the user.
The numeric code is *supposed* to be adequate AIUI, and allows the client to
display an error in the user's native language.
> The real explanation is probably in the message body and that
> unfortunately is probably html and not so easy to display...
Yeah. For GET requests, the user can always paste the URL into their browser
manually. That doesn't really apply to POSTs, though :(
-Andrew.
More information about the bazaar
mailing list