I know that missing the content-length header is a 411, but not sure how I should respond when the value given in the content-length does not match the actual content length
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The standard seems silent on the actual code to respond with, only that the two lengths MUST match and that HTTP/1.1 agents MUST notify the user.
I would just use the
400 Bad Requestcode since that is, after all, what the problem is (a request violating the standard) and none of the other 400-series codes seems a close enough match. Thex00codes also define the class of a status so can be used for a generic code.Keep in mind that the codes are extendable, you can always define your own, and agents that don’t recognise it are required to treat it as an
x00variant anyway (section 6.1.1 of RFC2616):