0

Can someone please point me in the right direction? I've completed both load() and parse() but check50 is still returning the following:

:( Requesting non-existant file returns error code 404
\ expected output, but not "HTTP/1.1 501 Not Implemented\r\nContent..."

Everything else passes. I'm confused as to why there is a check for an error code 404 even though the specifications for parse() contain no mention of checking for a 404 error.

Here's a link to my parse(): (removed)

1

The distro code returns 404 if a non-existent file (around line 209). This parse function only and ever gives error 501 and returns false therefore it never gets to that test. check50 didn't expect a 501, it expected a 400. That's the first thing you need to fix.

Spoiler Alert!! After you fix that, you will find that your abs_path (and query) are not going to work. Since strtok returns a pointer

The strtok() and strtok_r() functions return a pointer to the next token

and abs_path/query (in parse) are pointers, you are effectively giving them new addresses here

abs_path = strtok(target, "?");
query = strtok(NULL, " ");

When you return to the caller, it will be looking for abs_path and query at the addresses it sent to parse(). The contents at those addresses are not updated.

You must log in to answer this question.

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