Re: HTTP_Client, HTTP_Request or Net_Url problem
| From: | Justin Patrin | Date: | Wed, 17 May 2006 00:38:31 +0000 |
| Subject: | Re: HTTP_Client, HTTP_Request or Net_Url problem | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-42522@lists.php.net to get a copy of this message | ||
On 5/16/06, Markus Fischer <markus@fischer.name> wrote:
Hi, we've found a case were HTTP_Client causes a bad request in apache: 1) Sent HTTP_Client to e.g. http://server/url/ 2) http://server/url/ has actually a redirect (Location:) to "http://server/otherurl?var=has space" 3) Apache responds with a bad request Usual Browser clients recognize the space and encode it, this doesn't happen with HTTP_Client. Now, HTTP_Client internally uses HTTP_Request which recognizes the Location: and takes the URL "as is" and create a new Net_Url from it (in HTTP_Request::sendRequest() ). Net_Url, as it seems, doesn't do anything special with the url, it just sets it to its own property 'this->url' and that's it. To have our application work we had to apply urlencode() before we sent the Location: over the wire. Now, this is likely possible that this violates the spec, but in this case other Agents can handle this pretty good, so maybe this can done with the PEAR components too?As Phillipe said, space is not allowed in URLs. Whatever webserver is sending the bad redirect *ought* to be fixed. That said, this case is one that is easily fixable by the agent as space (AFAIK) has no special meanung in URLs. This could easily be fixed in Net_URL when a URL is given to it, but IMHO it should be done as an option so that incorrect URLs can also be detected and an error returned. -- Justin Patrin