[cse491] reading complete requests

C. Titus Brown ctb at msu.edu
Sat Oct 3 06:31:34 PDT 2009


On Fri, Oct 02, 2009 at 09:04:07PM -0400, Joe Amenta wrote:
> 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.

Yes, that was the intent -- actually, the real intent was to show you the
testing stuff, and to make it relevant I adapted it to the homework.

> 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.

As you pointed out, there is no way to assess "end of request" for a POST other
than by looking at the Content-Length header.  The most likely effect of
messing this up will be either truncated POST data (which you wouldn't notice
for this HW) _or_ a hang from trying to read past the end of what the client
sent.

--titus



More information about the cse491-fall-2009 mailing list