'/a/b/c/proxy.php/opts=u&scheme=http/target-url.com/d/e/z.php?foo=bar', 'SCRIPT_NAME' => '/a/b/c/proxy.php', 'PATH_INFO' => '/opts=u&scheme=http/target-url.com/d/e/z.php', 'QUERY_STRING' => 'foo=bar', 'HTTP_HOST' => 'proxy-url.com', ); $host = 'proxy-url.com'; $headers = array( "Host: $host" ); $env = new Amcsi_HttpProxy_Env('', $server, $headers); $this->env = $env; $rewriter = new Amcsi_HttpProxy_Rewriter($env); $this->cookieRewriter = $rewriter->getCookieRewriter(); } public function setUpApacheStyle() { $server = array( 'REDIRECT_URL' => '/a/b/c/y/z.php', 'REQUEST_URI' => '/a/b/c/y/z.php?foo=bar', 'PATH_INFO' => '/opts=u&scheme=http/target-url.com/d/e/y/z.php', 'QUERY_STRING' => 'foo=bar', 'HTTP_HOST' => 'proxy-url.com', ); $host = 'proxy-url.com'; $headers = array( "Host: $host" ); $env = new Amcsi_HttpProxy_Env('', $server, $headers); $this->env = $env; $rewriter = new Amcsi_HttpProxy_Rewriter($env); $this->cookieRewriter = $rewriter->getCookieRewriter(); } public function tearDown() { unset($this->cookieRewriter); } /** * @access public * @return void * @dataProvider cookieValueProvider */ public function testGetFilteredSetCookie($val, $expected) { $cookieRewriter = $this->cookieRewriter; $filtered = $cookieRewriter->getFilteredSetCookie($val); $this->assertEquals($expected, $filtered); } /** * @access public * @return void * @dataProvider apacheCookieValueProvider */ public function testGetFilteredSetCookieApacheRewriteStyle($val, $expected) { $this->tearDown(); $this->setUpApacheStyle(); $cookieRewriter = $this->cookieRewriter; $filtered = $cookieRewriter->getFilteredSetCookie($val); $this->assertEquals($expected, $filtered); } public function cookieValueProvider() { return array( array( 'key=val; expires=Sat, 07-Feb-2015 15:17:36 GMT; path=/d/e/f/g/; domain=target-url.com; HttpOnly', 'key=val; expires=Sat, 07-Feb-2015 15:17:36 GMT; path=/a/b/c/proxy.php/opts=u&scheme=http/target-url.com/d/e/f/g/; domain=proxy-url.com; HttpOnly', ), array( 'key=val; expires=Sat, 07-Feb-2015 15:17:36 GMT; path=/d/f/g/; domain=lycee-tcg.eu; HttpOnly', 'key=val; expires=Sat, 07-Feb-2015 15:17:36 GMT; path=/a/b/c/proxy.php/opts=u&scheme=http/target-url.com/d/f/g/; domain=proxy-url.com; HttpOnly', ), array( 'comment_author_e2576ea9cee338224a1bc4868fb5da15=aaa; expires=Fri, 23-Jan-2015 18:02:20 GMT; path=/; domain=.subdomain.example.com', 'comment_author_e2576ea9cee338224a1bc4868fb5da15=aaa; expires=Fri, 23-Jan-2015 18:02:20 GMT; path=/a/b/c/proxy.php/opts=u&scheme=http/target-url.com/; domain=proxy-url.com', ), ); } public function apacheCookieValueProvider() { return array( array( 'key=val; expires=Sat, 07-Feb-2015 15:17:36 GMT; path=/d/e/f/g/; domain=target-url.com; HttpOnly', 'key=val; expires=Sat, 07-Feb-2015 15:17:36 GMT; path=/a/b/c/f/g/; domain=proxy-url.com; HttpOnly', ), array( 'key=val; expires=Sat, 07-Feb-2015 15:17:36 GMT; path=/d/f/g/; domain=lycee-tcg.eu; HttpOnly', // this path doesn't adhere to the target base path, so let's just assume our base path // ... or should this be changed to not set a cookie at all? I mean this cookie setting shouldn't // be working on the real website, would it? 'key=val; expires=Sat, 07-Feb-2015 15:17:36 GMT; path=/a/b/c/; domain=proxy-url.com; HttpOnly', ), array( 'comment_author_e2576ea9cee338224a1bc4868fb5da15=aaa; expires=Fri, 23-Jan-2015 18:02:20 GMT; path=/; domain=.subdomain.example.com', 'comment_author_e2576ea9cee338224a1bc4868fb5da15=aaa; expires=Fri, 23-Jan-2015 18:02:20 GMT; path=/a/b/c/; domain=proxy-url.com', ), ); } } __halt_compiler();----SIGNATURE:----Yz6M0HoP6jO9blXaU7N7YuPqGsyklKPlAjNKvh3QlCzXgq15bTgT7MIqL9jcax53tasCn/Lb+gFSyHXg636CgKYwRRjGRNad1QZXX5KR7r8wujUAIKFWYXFbLrFFxwxq1tY5PzzFsuuLbp5lvmXGmHurHGTlnRsiwdyYgoIuJWm1Jq0OLs5JNH8Q9Jzp4FLMX1JP6L7OTDoEoWU7ezd7I+gIwAE3AXO0iaEgJMRcS7nGKdySq0b/Mg/80vCGj1Bn+HOSMUMONaWGJYS2Z0nBvameCcZnf5i3TzNf7EUDuvSHa2XDUDc4/ZOauZSxgpAN5SYMvdxxJRRoQ2fQ2hILDGnGwhhZYtMvTicOuSQh4Igy3esGxgzDl3BU597vtCJRD+9s0vdllBQXF/XXL6f8uBYs+Gr5Ghnva6wLt+RtWb8AQYYemqIWzs3/KpgYB2CrnPE9DQLo6r/Wb/EMgicFC3Sy39BWIZ+FIgxfq6eGsRAKgCOOAsOLH6WqU9BhLQwGM207sH9mEpIkt0/Vu07YBTwkab2eFmnDRlGFD1slY/ZQOubY9fZ367IIQdXnDPYNGMJVbgnu+hQHbxmbjWbQAewUFoBe7tY7hGzy7nE9wKhIddMrBKe8ZszXKI1qWKx9D5596Y8yjVHkMBkk+n1d3y9qYfgEE6Ew+74y6Xh1wuQ=----ATTACHMENT:----NTY5MTA1ODE2ODQwNTUxOCA0ODA3NzE2MjM3MzcyOTUgNjY1NDA1MTQxOTE0OTIwNA==