ValueError: need more than 2 values to unpack

Bug #508804 reported by Martin Schaaf
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
BeeSeek
Fix Released
High
Martin Schaaf

Bug Description

Please include the following details in your bug report:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/beeseek/web/servers/baseserver.py", line 188, in serve_request
    method(client, requestdata)
  File "/usr/lib/pymodules/python2.6/beeseek/web/servers/http.py", line 211, in process_request
    client, host, method, page, clientheaders, httpver)
  File "/usr/lib/pymodules/python2.6/beeseek/web/servers/http.py", line 293, in _send_page_from_host
    (status, reason, httpver), serverheaders = host.read_response()
  File "/usr/lib/pymodules/python2.6/beeseek/web/protocols/http.py", line 296, in read_response
    statusline = self._read_status_line()
  File "/usr/lib/pymodules/python2.6/beeseek/web/protocols/http.py", line 126, in _read_status_line
    version, status, reason = data.split(' ', 2)
ValueError: need more than 2 values to unpack
OOPS: HPC-4B5321FF

Related branches

Revision history for this message
Martin Schaaf (mascha) wrote :

The error comes on opening this site: http://www.dswillis.com/uxcrank/#details

Revision history for this message
Andrea Corbellini (andrea.corbellini) wrote :

Thank you for your help. I can confirm the issue.

Changed in beeseek:
importance: Undecided → High
status: New → Triaged
Revision history for this message
Martin Schaaf (mascha) wrote :

The response from this server is 'HTTP/1.1 301\r\n'

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 = ''

This fixes the problem for me.

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

Martin Schaaf (mascha)
Changed in beeseek:
assignee: nobody → Martin Schaaf (mascha)
Changed in beeseek:
status: Triaged → In Progress
Revision history for this message
Andrea Corbellini (andrea.corbellini) wrote :

Fixed in revision 417.

Changed in beeseek:
milestone: none → 1.0b4
status: In Progress → Fix Committed
Changed in beeseek:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.