PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTTP » HTTP » Bug #3378

absoluteURI always applies https protocol under IIS6

Details

Submitted2005-02-04 14:25 UTC
Frompjswaine at alphazero dot freeserve dot co dot uk
Assignedmike
StatusClosed
PackageHTTP
PHP Version4.3.1
OSWindows NT
Roadmaps(Not assigned)

Comments

[2005-02-04 14:25 UTC] pjswaine at alphazero dot freeserve dot co dot uk

Description:
------------
On IIS6 absoluteURI() always returns a URI with the https protocol when a relative address is fed in.

The problem stems from the environmental setting $_SERVER['HTTPS'] which behaves differently under IIS than under Apache. On Apache $_SERVER['HTTPS'] is not set when the protocol is http, but IIS does set it - to "off".

Hence line 288 in version 1.3.3 only checks to see if $_SERVER['HTTPS'] is set, not whether it is set to "on".

Reproduce code:
---------------
Line 288 of HTTP.php v1.3.3 reads:

$protocol = isset($_SERVER['HTTPS']) ? 'https' : 'http';

To fix the issue under IIS it could read:

$protocol = (isset($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) === "on") ? 'https' : 'http';