Browse Source

Disable redirect handling in the adapter.

Redirect handling has been moved into the client because of cookie
handling issues. See #10876
Mark Story 8 years ago
parent
commit
e0910ea3a4

+ 3 - 3
src/Http/Client/Adapter/Stream.php

@@ -198,9 +198,9 @@ class Stream
         if (isset($options['timeout'])) {
             $this->_contextOptions['timeout'] = $options['timeout'];
         }
-        if (isset($options['redirect'])) {
-            $this->_contextOptions['max_redirects'] = (int)$options['redirect'];
-        }
+        // Redirects are handled in the client layer because of cookie handling issues.
+        $this->_contextOptions['max_redirects'] = 0;
+
         if (isset($options['proxy']['proxy'])) {
             $this->_contextOptions['request_fulluri'] = true;
             $this->_contextOptions['proxy'] = $options['proxy']['proxy'];

+ 1 - 1
tests/TestCase/Http/Client/Adapter/StreamTest.php

@@ -182,7 +182,7 @@ class StreamTest extends TestCase
             'Cookie: testing=value; utm_src=awesome',
         ];
         $this->assertEquals(implode("\r\n", $expected), $result['header']);
-        $this->assertEquals($options['redirect'], $result['max_redirects']);
+        $this->assertSame(0, $result['max_redirects']);
         $this->assertTrue($result['ignore_errors']);
     }