Re: HTTP_Client, HTTP_Request or Net_Url problem

From: Date: Wed, 17 May 2006 16:15:00 +0000
Subject: Re: HTTP_Client, HTTP_Request or Net_Url problem
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-42524@lists.php.net to get a copy of this message
On 5/17/06, Markus Fischer <markus@fischer.name> wrote:
Justin Patrin wrote:
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. I through that too, but in real live all browser are capable of handling a 'space' in 'Location:' header properly without telling the user of an invalid url. So, as you said, it boils down to:
Yes, we know. Spaces are one of those things that are easily recoverable. However, it does violate the spec and likely some browsers will choke on certain uses of spaces.
* what should Net_URL do with invalid URLs? * Should it be possible to have a valid Net_URL object with an invalid URL?
It's not that the browsers use the bad URL. You can't send a URL with a space in it and expect the web server to process it correctly. Net_URL would need to detect spaces in the URL and replace them with %20. This could be done with a simple str_replace call, actually. -- Justin Patrin

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