[cse491] reading complete requests

Joe Amenta amentajo at msu.edu
Fri Oct 2 18:04:07 PDT 2009


Example request:

GET /form.cgi?username=mille449&password=saved HTTP/1.0

The query string in that request would be
"username=mille449&password=saved", or in other words, everything following
the first "?" in the URL.

As for the example code, yes, that would not read the POST data... perhaps
the intent was just to show a way to handle the simple case, so that we can
build off of it?  In any case, yes, that example code will fail to read in
POST data, thus it should probably not get full credit.

To read until the request is complete... this is an example of something
that we can figure out through investigation.  One way to go about this
would be to use form.html from way back in HW1.  Set the "method" to point
to your web server, and then use print statements to figure out what the
data looks like when it comes in.  (Might be useful to use repr() on the
incoming data to see exactly what it looks like)

I don't know what "end of request" will look like myself (though I have a
couple of guesses) so at this point I can't be any more helpful than that.

--Joe

On Fri, Oct 2, 2009 at 5:58 PM, Tim Miller <mille449 at msu.edu> wrote:

> Titus,
>
> In the assignment for hw4 you specify:
>
> The server should respond to both GET and POST requests, and should
> read and ignore any GET query strings and POST data.
>
> However in your example code you have a line that looks like this:
>
> if '\r\n\r\n' in data_so_far:  # complete GET request - respond & close
>
> If I understand correctly, the server would stop receiving after the
> first '\r\n\r\n' and would not read the POST data, so how do I read
> until the request is complete, assuming there is no Content-Length
> header?  Also, how are GET query strings specified again?  I can't
> seem to find it anywhere.
>
> Thanks
>
>
> --Tim
>
> _______________________________________________
> cse491-fall-2009 mailing list
> cse491-fall-2009 at lists.idyll.org
> http://lists.idyll.org/listinfo/cse491-fall-2009
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/cse491-fall-2009/attachments/20091002/07404d55/attachment.htm>


More information about the cse491-fall-2009 mailing list