[thelist] Correct 'Bad Request/Malformed Request' HTTP Error Code
Burhan Khalid
thelist at meidomus.com
Sat Jul 23 07:10:42 CDT 2005
Jens Brueckmann wrote:
> 2005/7/23, Burhan Khalid <thelist at meidomus.com>:
>
>
>> For example, say a valid request is
>> file.ext?op=beta
>>
>> and someone requests file.ext?op=lalalala
>> I want to send out 400 Bad Request (is this the right response?)
>
>
> I would rather say this is not a 'Bad Request', as the syntax and URI are valid.
> As no corresponding page is available for this request, it is a plain
> 'Not Found' error.
>
> More on status codes see
> http://www.w3.org/Protocols/HTTP/1.1/spec.html#Code4xx
>
>
>>how would I actually send that out? Using PHP, you can write custom
>>headers using the header() function, and at first glance, this would
>>seem like :
>>
>> header('Bad Request',true,400);
>
>
> No. The correct expression is something like:
>
> header("HTTP/1.1 400 Bad Request");
>
> or rather:
>
> header("HTTP/1.1 404 Not Found");
Thanks Jens. I wasn't 100% on the Bad Request either.
More information about the thelist
mailing list