RE: [PEAR-DEV] Re: HTTP_Request bug
| From: | Dave Mertens | Date: | Mon, 06 Oct 2003 08:53:02 +0000 |
| Subject: | RE: [PEAR-DEV] Re: HTTP_Request bug | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-22396@lists.php.net to get a copy of this message | ||
> >> 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.
It's not my code, i'm just back from a big break (4 months) an saw that this bug was still
open.
> And its not only the http server. It may be the programmer who generated
> this bad(lower case) header. Like I did :-).
for myself, i don't see any problems implementing a case insensitive location header check.
Let's wait for a few reactions from the pear community before we decide anything, alright?
With best regards,
Dave Mertens