Re: [Patch] HTTP::absoluteURI() port redundancy
| From: | Turadg Aleahmad | Date: | Fri, 10 Sep 2004 17:55:55 +0000 |
| Subject: | Re: [Patch] HTTP::absoluteURI() port redundancy | ||
| References: | 1 2 3 4 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-33334@lists.php.net to get a copy of this message | ||
Philippe,
Sorry to beat this dead horse, but I thought it worth pointing out that in your example one could simply use HTTP::absoluteURI('file.zip', 'ftp') instead, sans port argument. But if the user does want to be redunantly specific and specify the port number, no need to override them.
The problem I had was that the code was appending port 80 or 443 even when I didn't ask for it. As I pointed out in my previous message, it only does this when the protocol is 'http' or 'https'.
-Turadg
Philippe Jausions wrote:
Turadg, If you look closely to the API, you'll see you have the opportunity to switch protocol and/or port when you redirect. This is convenient to redirect a visitor from HTTP or HTTPS to whatever protocol or port on same current server... For example from a public area to a secured one, or FTP file download section... This way HTTP::absoluteURI('file.zip', 'ftp', 21) shouldn't append the ":21" to the FTP server name, but port '2121' would... Anyway, that was the idea behind it... -Philippe Turadg Aleahmad wrote:Philippe Jausions wrote:I introduced a private method to check against common default port numbers. You patch only takes care of http and https. What about ftp, telnet and other URL the user could be redirected to...?For one, this package is called HTTP. For two, the only way a port gets appended automatically is it comes from $_SERVER['SERVER_PORT'], which will always be from http or https. Maybe you want to write a general URI class, a la java.net.URI? -Turadg