Comment 4 for bug 508804

Revision history for this message
Andrea Corbellini (andrea.corbellini) wrote : Re: [Bug 508804] Re: ValueError: need more than 2 values to unpack

On Tue, 2010-01-19 at 20:12 +0000, Martin Schaaf wrote:
> The response from this server is 'HTTP/1.1 301\r\n'

That's strange because according to the protocol specification [1] the
reason phrase must be included. However, if there's a server that sends
such responses, the proxy must be able to handle them correctly.

> Here is my fix for it:
>
> Change in http.py line 126
> from
>
> version, status, reason = data.split(' ', 2)
>
> to
>
> try:
> version, status, reason = data.split(' ', 2)
> except:
> version, status = data.split(' ')
> reason = ''

Thank you for providing a patch! There are just few things to fix. If
you want, you can create a code branch and propose a merge request.
Else, if you don't have the time to do so, I can merge and fix your
changes directly.

Feel free to ask if you need some help.

[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1