[cse491] omg help

Kaben Nanlohy kaben.nanlohy at gmail.com
Thu Oct 2 01:57:17 PDT 2008


Hi Brett,

The traceback says that the error occurs in the unit test named
"test_GET_1byte". The docstring for that test reads "Test that we can
feed the socket data in 1 byte at a time and still get the right
answer."

So your version of handle_connection doesn't give the right answer
when the client's web request comes in one byte at a time. To see why
this doesn't work, go to the python command line, and type:

>>> data = "G"
>>> content,lines = data.split('\r\n\r\n',1)

Now type:

>>> print data.split('\r\n\r\n',1)

Now try:

>>> data = "GET /some/path HTTP/1.0\r\n\r\n"
>>> print data.split('\r\n\r\n',1)

And look at the difference. The difference will help explain the error
in the traceback: "need more than 1 value to unpack". It reveals that
your version of handle_connection doesn't have any way of receiving
one byte at a time while aggregating those bytes into something that's
eventually big enough to split('\r\n\r\n',1) successfully.

I'm pretty sure this hint will help you solve the problem. I'll be up
again in a few hours if you're still stuck.

-- Kaben

On Thu, Oct 2, 2008 at 01:33, Brett Thomas Mcmillen <mcmill94 at msu.edu> wrote:
>
> Hi everyone,
>
> Someone explain to me why I am getting this error and what I can do to fix
> it:
>
> Traceback (most recent call last):
>  File "H:\CSE491\homework5\webserve-test.py", line 263, in test_GET_1byte
>   webserve.handle_connection(fake_socket, None)
>  File "H:\CSE491\homework5\webserve.py", line 38, in handle_connection
>   content,lines = data.split('\r\n\r\n',1)
> ValueError: need more than 1 value to unpack
>
>
> I've been here since 4pm, please help :(
>
> Thanks a ton!,
> Brett Mac
>
>
> _______________________________________________
> cse491-fall-2008 mailing list
> cse491-fall-2008 at lists.idyll.org
> http://lists.idyll.org/listinfo/cse491-fall-2008
>



More information about the cse491-fall-2008 mailing list