0

In the specs for pset6 it says the following:

whereby absolute-path (which will not contain ?) must start with / and might optionally be followed by a ? followed by a query, which may not contain ".

Ensure that request-line (which is already stored for you in a variable called line) is consistent with these rules. If it is not, respond to the browser with 400 Bad Request.

So if the path for the request-target does not begin with / then I should return a 400 error. The extra conditions say the following though:

if request-target does not begin with /, respond to the browser with 501 Not Implemented;

Does this mean I should respond with both a 400 and a 501 error, if the path doesn't start with /?

1 Answer 1

0

You only need to respond with a single error message. ( I believe you can only respond with one error, but I could be wrong.)If you reread the spec, it essentially says to make sure the request line meets certain rules or return 400. More significantly, it says "even if it meets these rules..." and goes on to describe additional fails. In other words, validate for 400 first, and then for the 501.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

3
  • If I validate for the 400 isn't it then pointless to validate for the 501?
    – Gary
    Commented Dec 8, 2015 at 19:34
  • exactly. If it fails the 400 validation, the rest is pointless. It's still possible to pass the 400 validation and fail the 501.
    – Cliff B
    Commented Dec 8, 2015 at 19:36
  • How is it possible to pass the 400 and fail the 501, they would be checking the same thing?
    – Gary
    Commented Dec 8, 2015 at 19:40

You must log in to answer this question.

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