<div>I made my program stop on first parse error. I didn't close the connection from the parsing function, I just stopped parsing further.</div>
<div> </div>
<div>Despite what people say, I like <goto>'s. They help in a non-OOP language like ANSI C.</div>
<div>Rick<br><br> </div>
<div><span class="gmail_quote">On 9/25/07, <b class="gmail_sendername">Niels Joubert</b> <<a href="mailto:niels@berkeley.edu">niels@berkeley.edu</a>> 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'm having some trouble interpreting the spec. According to it, "for<br>
invalid requests, proint out an error message indicating which token is<br>missing or illformed". 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 "for each error encouteres, [it] should<br>print one of the corresponding error messages". This sounds like you<br>should keep parsing and print all the possible error messages. The case
<br>i'm confused about is the following:<br><br>The server receives "/Research/Areas/OSNT/index.html HTTP/1.0"<br>Thus is parsing from left to right you encounter an "illformed method<br>token" 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>> ---------------------------------------------------------<br>> TOKEN FAILURES/PATTERN MATCHING:
<br>> ---------------------------------------------------------<br>><br>> Our grading will use greedy token matching.<br>><br>> e.g.<br>><br>> GET/foo HTTP/1.0<br>><br>> ---> Should return a valid method, but invalid pathname.
<br>><br>> However, for grading for this milestone, either will be fine.<br>><br>><br>> ---------------------------------------------------------<br>> COMMAND LINE ARGUMENTS<br>> ---------------------------------------------------------
<br>><br>> For the client:<br>><br>> Part A requires command line arguments: http_client <server> <port><br>> Part B SHOULD NOT USE command line arguments: http_client<br>><br>> Therefore, since we are really targeting Part B, your final client
<br>> should not use command line arguments.<br>><br>><br>> For the server:<br>><br>> Part A: Specify the port on the command line: http_server <port><br>> Part B: OPTIONALLY specify the port on the command line: http_server <port>
<br>> DEFAULT to port 80 for the server.<br>><br>><br>> ---------------------------------------------------------<br>> SERVER-TO-CLIENT DATA<br>> ---------------------------------------------------------
<br>><br>> Upon receipt of a valid request, the server will both:<br>><br>> (1) echo that request to the client over the network. This echoed<br>> request INCLUDES THE CRLF<br>><br>> (2) print that request to stdout, followed immediately by the
<br>> components of the request, per the PDF<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>><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>