After doing a little research, for this project, we must use <code>Content-Length</code> to determine the size of the <code>POST</code> body and put the burden of supplying that field on the client.  Source:<br><br><a href="http://www.w3.org/Protocols/HTTP/1.0/spec.html#BodyLength">http://www.w3.org/Protocols/HTTP/1.0/spec.html#BodyLength</a><br>

<br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">When an <code>Entity-Body</code> is included with a message, the length of that body may be determined in 
   one of two ways. If a <code>Content-Length</code> header field is present, its value in bytes represents the 
   length of the <code>Entity-Body</code>. Otherwise, the body length is determined by the closing of the 
   connection by the server.


   Closing the connection cannot be used to indicate the end of a request body, since it leaves no 
   possibility for the server to send back a response.  Therefore, HTTP/1.0 requests containing an 
   entity body must include a valid <code>Content-Length</code> header field.  If a request contains an entity body 
   and <code>Content-Length</code> is not specified, and the server does not recognize or cannot calculate the 
   length from other fields, then the server should send a 400 (bad request) response.

</blockquote><br>1) since we&#39;re implementing a subset of HTTP/1.0, we will have <code>Content-Length</code> in well-formed <code>POST</code> requests.  (read the last line above for what to do if the request is not well-formed)<br>

2) even if we were to implement the close-the-connection way of determining <code>Content-Length</code>, we would have no connection open to send back the response.<br><br>Hope this helps,<br>--Joe<br><br><div class="gmail_quote">

On Fri, Oct 2, 2009 at 9:04 PM, Joe Amenta <span dir="ltr">&lt;<a href="mailto:amentajo@msu.edu">amentajo@msu.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Example request:<br><br>GET /form.cgi?username=mille449&amp;password=saved HTTP/1.0<br><br>The query string in that request would be &quot;username=mille449&amp;password=saved&quot;, or in other words, everything following the first &quot;?&quot; in the URL.<br>


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


<br>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 &quot;method&quot; 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)<br>


<br>I don&#39;t know what &quot;end of request&quot; will look like myself (though I have a couple of guesses) so at this point I can&#39;t be any more helpful than that.<br><font color="#888888"><br>--Joe</font><div><div>

</div><div class="h5"><br><br><div class="gmail_quote">On Fri, Oct 2, 2009 at 5:58 PM, Tim Miller <span dir="ltr">&lt;<a href="mailto:mille449@msu.edu" target="_blank">mille449@msu.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Titus,<br>
<br>
In the assignment for hw4 you specify:<br>
<br>
The server should respond to both GET and POST requests, and should<br>
read and ignore any GET query strings and POST data.<br>
<br>
However in your example code you have a line that looks like this:<br>
<br>
if &#39;\r\n\r\n&#39; in data_so_far:  # complete GET request - respond &amp; close<br>
<br>
If I understand correctly, the server would stop receiving after the<br>
first &#39;\r\n\r\n&#39; and would not read the POST data, so how do I read<br>
until the request is complete, assuming there is no Content-Length<br>
header?  Also, how are GET query strings specified again?  I can&#39;t<br>
seem to find it anywhere.<br>
<br>
Thanks<br>
<br>
<br>
--Tim<br>
<br>
_______________________________________________<br>
cse491-fall-2009 mailing list<br>
<a href="mailto:cse491-fall-2009@lists.idyll.org" target="_blank">cse491-fall-2009@lists.idyll.org</a><br>
<a href="http://lists.idyll.org/listinfo/cse491-fall-2009" target="_blank">http://lists.idyll.org/listinfo/cse491-fall-2009</a><br>
</blockquote></div><br>
</div></div></blockquote></div><br>