[thelist] Correct 'Bad Request/Malformed Request' HTTP Error Code

Burhan Khalid thelist at meidomus.com
Sat Jul 23 05:13:35 CDT 2005


Hello Everyone:

   I'm writing a backend of sorts, and want to send out the correct 
header if a client sends a request that isn't correctly formed.

   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?), but 
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);

   Is this correct? Not really familiar with HTTP status codes.

Thanks for any hints,
Burhan


More information about the thelist mailing list