[Project_owners] PHP Not Respecting header()

Douglas E. Warner silfreed at silfreed.net
Wed Dec 19 07:37:21 PST 2007


On Tuesday 18 December 2007, David White wrote:
> Thanks for the response. However, I may not have made myself clear...
>
> If I return the following:
>
> <?php
> header("HTTP/1.0 400 foobar");
> ?>
>
> I expect the recipient program to see the reason phrase as "foobar". But
> what is sees is "BAD REQUEST".
>
> I understand that the reason phrase for 400 is shown in the HTTP spec to
> be "Bad Request". However, the spec also says that this may be replaced
> without affecting the protocol.
>
> I don't see anywhere in the PHP docs that says I cannot do this. Indeed,
> header() is for sending "raw" headers. To me that means NOT manipulating
> them. But maybe there is no way around this. Maybe if I send something >
> 600, PHP will leave it alone?

I doubt it's a PHP problem.  Perhaps trying to inspect the headers sent back 
with something like LiveHTTPHeaders would be more helpful to ensure that the 
appropriate values are being returned; I suspect it's just that the browser 
is seeing "error 400" and putting up its own message.

-Doug

-- 
Douglas E. Warner    <silfreed at silfreed.net>    Site Developer
Mozdev.org           http://www.mozdev.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://www.mozdev.org/pipermail/project_owners/attachments/20071219/e0c958c4/attachment.bin 


More information about the Project_owners mailing list