<div>I made my program stop on first parse error. I didn&#39;t close the connection from the parsing function, I just stopped parsing further.</div>
<div>&nbsp;</div>
<div>Despite what people say, I like &lt;goto&gt;&#39;s. They help in a non-OOP language like ANSI C.</div>
<div>Rick<br><br>&nbsp;</div>
<div><span class="gmail_quote">On 9/25/07, <b class="gmail_sendername">Niels Joubert</b> &lt;<a href="mailto:niels@berkeley.edu">niels@berkeley.edu</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">On token failures:<br><br>I&#39;m having some trouble interpreting the spec. According to it, &quot;for<br>
invalid requests, proint out an error message indicating which token is<br>missing or illformed&quot;. This sounds like you parse from left to right,<br>until you get something that doesnt match. When that occurs, you print
<br>an error message and stop.<br><br>A little further down, it claims &quot;for each error encouteres, [it] should<br>print one of the corresponding error messages&quot;. This sounds like you<br>should keep parsing and print all the possible error messages. The case
<br>i&#39;m confused about is the following:<br><br>The server receives &quot;/Research/Areas/OSNT/index.html HTTP/1.0&quot;<br>Thus is parsing from left to right you encounter an &quot;illformed method<br>token&quot; that happens to be a perfectly well formed uri. Should you print
<br>an error for method token, or keep going? An if you do keep going, i<br>assume you will now try to match the next part of the string, being<br>HTTP/1.0 to request-uri and also give a misformed request-uri error<br>message. Since the string is now at end, do you stop, or do you print
<br>the error messages that corresponds with the rest of the unmatched data?<br><br>In a nutshell - should i parse left to right, using one regex at a time<br>and keeping track of where I am in the recieved string, and stop with an
<br>error message on the first incorrect input, or is something more fancy<br>required?<br><br>Thanks!<br><br>-Niels<br><br>Lisa Fowler wrote:<br>&gt; ---------------------------------------------------------<br>&gt; TOKEN FAILURES/PATTERN MATCHING:
<br>&gt; ---------------------------------------------------------<br>&gt;<br>&gt; Our grading will use greedy token matching.<br>&gt;<br>&gt; e.g.<br>&gt;<br>&gt; GET/foo HTTP/1.0<br>&gt;<br>&gt; ---&gt; Should return a valid method, but invalid pathname.
<br>&gt;<br>&gt; However, for grading for this milestone, either will be fine.<br>&gt;<br>&gt;<br>&gt; ---------------------------------------------------------<br>&gt; COMMAND LINE ARGUMENTS<br>&gt; ---------------------------------------------------------
<br>&gt;<br>&gt; For the client:<br>&gt;<br>&gt; Part A requires command line arguments:&nbsp;&nbsp;http_client &lt;server&gt; &lt;port&gt;<br>&gt; Part B SHOULD NOT USE command line arguments:&nbsp;&nbsp; http_client<br>&gt;<br>&gt; Therefore, since we are really targeting Part B, your final client
<br>&gt; should not use command line arguments.<br>&gt;<br>&gt;<br>&gt; For the server:<br>&gt;<br>&gt; Part A:&nbsp;&nbsp;Specify the port on the command line:&nbsp;&nbsp;http_server &lt;port&gt;<br>&gt; Part B:&nbsp;&nbsp;OPTIONALLY specify the port on the command line:&nbsp;&nbsp;http_server &lt;port&gt;
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DEFAULT to port 80 for the server.<br>&gt;<br>&gt;<br>&gt; ---------------------------------------------------------<br>&gt; SERVER-TO-CLIENT DATA<br>&gt; ---------------------------------------------------------
<br>&gt;<br>&gt; Upon receipt of a valid request, the server will both:<br>&gt;<br>&gt; (1) echo that request to the client over the network.&nbsp;&nbsp;This echoed<br>&gt; request INCLUDES THE CRLF<br>&gt;<br>&gt; (2) print that request to stdout, followed immediately by the
<br>&gt; components of the request, per the PDF<br>&gt; _______________________________________________<br>&gt; ee122 mailing list<br>&gt; <a href="mailto:ee122@mailman.ICSI.Berkeley.EDU">ee122@mailman.ICSI.Berkeley.EDU</a>
<br>&gt; <a href="http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/ee122">http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/ee122</a><br>&gt;<br><br>_______________________________________________<br>ee122 mailing list<br>
<a href="mailto:ee122@mailman.ICSI.Berkeley.EDU">ee122@mailman.ICSI.Berkeley.EDU</a><br><a href="http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/ee122">http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/ee122</a><br></blockquote>
</div><br>