<div class="gmail_quote">On Sat, Oct 3, 2009 at 8:49 AM, C. Titus Brown <span dir="ltr">&lt;<a href="mailto:ctb@msu.edu">ctb@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;">

<div class="im">On Fri, Oct 02, 2009 at 05:58:41PM -0400, Tim Miller wrote:<br>
&gt; Titus,<br>
&gt;<br>
&gt; In the assignment for hw4 you specify:<br>
&gt;<br>
&gt; The server should respond to both GET and POST requests, and should<br>
&gt; read and ignore any GET query strings and POST data.<br>
&gt;<br>
&gt; However in your example code you have a line that looks like this:<br>
&gt;<br>
&gt; if &#39;\r\n\r\n&#39; in data_so_far:  # complete GET request - respond &amp; close<br>
&gt;<br>
&gt; If I understand correctly, the server would stop receiving after the<br>
&gt; first &#39;\r\n\r\n&#39; and would not read the POST data, so how do I read<br>
&gt; until the request is complete, assuming there is no Content-Length<br>
&gt; header?  Also, how are GET query strings specified again?  I can&#39;t<br>
&gt; seem to find it anywhere.<br></div><br>
If you write a test for POSTs I&#39;m sure people would appreciate having you send<br>
it to the mailing list ;)<br>
<br>
--t<br>
<font color="#888888">--<br>
C. Titus Brown, <a href="mailto:ctb@msu.edu">ctb@msu.edu</a></font></blockquote><div><br>Attached is a test module that sends POST requests to a server with randomly-generated content of a randomly-generated length (the length of the randomly-generated content is always equal to the length specified in Content-Length... hack around with it if you want to test in other cases) and tests that the response would be valid.  If this test ever fails when it should not, then please reply with the response your server sent.  This should only be tested on a webserver written for hw #4; it just waste your time if you test it on other webservers.<br>

<br>Usage:<br>python test_post.py host port [iterations]<br><br>e.g.,<br>python test_post.py localhost 5000 # this will connect to port 5000 on localhost and try the default 100 random POST requests.<br>python test_post.py <a href="http://arctic.cse.msu.edu">arctic.cse.msu.edu</a> 24558 10 # this will connect to port 24558 on arctic and try just 10 random POST requests (for time&#39;s sake)<br>

<br>No output means that all runs of the test succeeded.  If there is a mismatch between expected response and received response, the response your HTTP server sent will be displayed on the screen, repr()&#39;d.<br><br>--Joe<br>

</div></div>