Re: [Patch] HTTP::absoluteURI() port redundancy
| From: | Stig S. Bakken | Date: | Fri, 10 Sep 2004 06:42:10 +0000 |
| Subject: | Re: [Patch] HTTP::absoluteURI() port redundancy | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-33328@lists.php.net to get a copy of this message | ||
Thanks! Added to HTTP-1.3.2.
- Stig
On Thu, 9 Sep 2004, Turadg Aleahmad wrote:
> This is a simple patch to eliminate the redundant port field of absolute
> URIs when it's already implied by the protocol. If given a relative URL
> like /myfile it will change it to
> http://$SERVER_NAME:$SERVER_PORT even
> if the port is 80. I use HTTP::redirect() on my site, which makes use
> of absoluteURI(), and Safari users have reported that they see the :80
> in their URLs. This isn't merely aesthetic; it confuses many users.
>
> The patch below checks if the port is already implied by the protocol
> and omits it if so.
>
> diff HTTP.php-in-cvs HTTP.php-that-I-edited
> 285a286,288
> >
> > if ($protocol == 'http' && $port == 80) unset($port);
> > if ($protocol == 'https' && $port == 443) unset($port);
>
>
> Note, this sounds similar but is different from Bug #1040.
>
>
> -Turadg
>
>