After a bit of wrestling, I thought I got parse and lookup to work. In my test file, the correct errors(I printf them) are printed out, but when I run check50, I get two things incorrect:

:( Requesting cat.exe returns error code 501
   \ expected output, but not "HTTP/1.1 505 HTTP Version Not Supported..."
:( Requesting non-existant file returns error code 404
   \ expected output, but not "HTTP/1.1 505 HTTP Version Not Supported..."

EDIT: (updated code) http://pastebin.com/vtS4sixj test code : http://pastebin.com/xcCpZDfv


if i delete the code that checks HTTP version, I get a return code of zero for those two errors, and I can't figure out why. My test file seems to work.


A big difference between the test program and server is the way you have created line. From the instructions:

Per 3.1.1 of http://tools.ietf.org/html/rfc7230, a request-line is defined as
method SP request-target SP HTTP-version CRLF

Add \r\n to the end of line, and you will see a different result. You should review this line very carefully, if (line[sp2 != '\r']). Looks like a typo.

It looks like path is not null terminated. That will trickle down to abs_path and likely give problems as you progress through the checks.

You do not have to call lookup from the parse function. It should simply return abs_path/query (or appropriate error message). Full stop. The main loop calls lookup.

This query = strchr(qery,'q'); is gonna give you problems. Observe in the address bar that hello.html will produce a request-target something like this hello.php?name=gilbert.

  • So the lookup function should return an error if the extension is not any of the ones included? the directions just say to return null. – Marcel Jul 4 '16 at 5:31
  • The lookup function should return NULL as stated in the directions.The main loop tests the return value from lookup, and gives a 501 if null. Around line 243 in the distro code. Suggest reading through the code from around line 183 (call to parse) to get a better sense of how the assignment functions are integrated into the supplied code. – DinoCoderSaurus Jul 4 '16 at 12:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .