X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FHttpUtils%2FServerUrlTest.php;h=324b827acc11e9612c933fa89893dfd318f523a3;hb=8e9fc6f6e6afc052a2c3b2d459764cc9ab20420a;hp=dac02b3e77cab58cdf05a57fbecfa3cabae1247b;hpb=844be5d55610f21e078f3325a1e4e20f41e5abb5;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/HttpUtils/ServerUrlTest.php b/tests/HttpUtils/ServerUrlTest.php index dac02b3e..324b827a 100644 --- a/tests/HttpUtils/ServerUrlTest.php +++ b/tests/HttpUtils/ServerUrlTest.php @@ -186,4 +186,36 @@ class ServerUrlTest extends PHPUnit_Framework_TestCase ) ); } + + /** + * Misconfigured server (see #1022): Proxy HTTP but 443 + */ + public function testHttpWithPort433() + { + $this->assertEquals( + 'https://host.tld', + server_url( + array( + 'HTTPS' => 'Off', + 'SERVER_NAME' => 'host.tld', + 'SERVER_PORT' => '80', + 'HTTP_X_FORWARDED_PROTO' => 'http', + 'HTTP_X_FORWARDED_PORT' => '443' + ) + ) + ); + + $this->assertEquals( + 'https://host.tld', + server_url( + array( + 'HTTPS' => 'Off', + 'SERVER_NAME' => 'host.tld', + 'SERVER_PORT' => '80', + 'HTTP_X_FORWARDED_PROTO' => 'https, http', + 'HTTP_X_FORWARDED_PORT' => '443, 80' + ) + ) + ); + } }