diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-07-13 14:15:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-13 14:15:06 +0200 |
commit | 2fee2f425d244e50ff64416f302a941a4470d8d2 (patch) | |
tree | f21fed77b74ee708026491dfcec44350f59cec9c /tests/HttpUtils/ServerUrlTest.php | |
parent | 70cb883547a04b3ccd3fda567d15541d124a3f41 (diff) | |
parent | 0b51ea72517efa8731348cfaed410c71cb2bfd91 (diff) | |
download | Shaarli-2fee2f425d244e50ff64416f302a941a4470d8d2.tar.gz Shaarli-2fee2f425d244e50ff64416f302a941a4470d8d2.tar.zst Shaarli-2fee2f425d244e50ff64416f302a941a4470d8d2.zip |
Merge pull request #899 from smuth4/master
Respect HTTP_X_FORWARDED_HOST
Diffstat (limited to 'tests/HttpUtils/ServerUrlTest.php')
-rw-r--r-- | tests/HttpUtils/ServerUrlTest.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/HttpUtils/ServerUrlTest.php b/tests/HttpUtils/ServerUrlTest.php index 7fdad659..dac02b3e 100644 --- a/tests/HttpUtils/ServerUrlTest.php +++ b/tests/HttpUtils/ServerUrlTest.php | |||
@@ -39,6 +39,34 @@ class ServerUrlTest extends PHPUnit_Framework_TestCase | |||
39 | } | 39 | } |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * Detect a Proxy that sets Forwarded-Host | ||
43 | */ | ||
44 | public function testHttpsProxyForwardedHost() | ||
45 | { | ||
46 | $this->assertEquals( | ||
47 | 'https://host.tld:8080', | ||
48 | server_url( | ||
49 | array( | ||
50 | 'HTTP_X_FORWARDED_PROTO' => 'https', | ||
51 | 'HTTP_X_FORWARDED_PORT' => '8080', | ||
52 | 'HTTP_X_FORWARDED_HOST' => 'host.tld' | ||
53 | ) | ||
54 | ) | ||
55 | ); | ||
56 | |||
57 | $this->assertEquals( | ||
58 | 'https://host.tld:4974', | ||
59 | server_url( | ||
60 | array( | ||
61 | 'HTTP_X_FORWARDED_PROTO' => 'https, https', | ||
62 | 'HTTP_X_FORWARDED_PORT' => '4974, 80', | ||
63 | 'HTTP_X_FORWARDED_HOST' => 'host.tld, example.com' | ||
64 | ) | ||
65 | ) | ||
66 | ); | ||
67 | } | ||
68 | |||
69 | /** | ||
42 | * Detect a Proxy with SSL enabled | 70 | * Detect a Proxy with SSL enabled |
43 | */ | 71 | */ |
44 | public function testHttpsProxyForward() | 72 | public function testHttpsProxyForward() |