Re: HTTP_Request bug

From: Date: Mon, 06 Oct 2003 08:37:24 +0000
Subject: Re: HTTP_Request bug
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-22395@lists.php.net to get a copy of this message
Dave Mertens wrote:
Hi sorry for writing you to this email but I forgot my pass at pear. The problem is that if the header is sent by the webserver with first letter lower case e.g. header('location : http://google.com'), you will process this and in the headers array of the response object will appear only location but not Location. So the check empty($this->_response->_headers['Location']) will always return true. What you have to do is change the above check to empty($this->_response->_headers['location']). Note the lowercase "L".
Ah, well a better solution would be using the case insensitive header, e.g. empty($this->_response->_headers['location_i']) According to the http rfc 2616 all http headers should start with an uppercase letter. See (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30) But as with most programs, variations can be found, so using the case insensitive header would be the best solution which would also work with non-compliant http server. And now the 64 million euro question: Do we want to support those non-compliant http servers? I am not sure :-). But Throuhout your code you use lowercase headers for check.
And its not only the http server. It may be the programmer who generated this bad(lower case) header. Like I did :-).
With best regards, Dave Mertens
-- Best Regards, Vassil Mihaylov Junior Developer Orbitel, Inc. tel.: +359 2 937 07 24 fax: +359 2 937 07 44

« previous php.pear.dev (#22395) next »