From e0910ea3a4db1176898412a48bbecff9c0ad9d93 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Sat, 8 Jul 2017 22:05:21 -0400 Subject: [PATCH] Disable redirect handling in the adapter. Redirect handling has been moved into the client because of cookie handling issues. See #10876 --- src/Http/Client/Adapter/Stream.php | 6 +++--- tests/TestCase/Http/Client/Adapter/StreamTest.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Http/Client/Adapter/Stream.php b/src/Http/Client/Adapter/Stream.php index 8d43e39dffe..f612dde4f3a 100644 --- a/src/Http/Client/Adapter/Stream.php +++ b/src/Http/Client/Adapter/Stream.php @@ -198,9 +198,9 @@ protected function _buildOptions(Request $request, $options) 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']; diff --git a/tests/TestCase/Http/Client/Adapter/StreamTest.php b/tests/TestCase/Http/Client/Adapter/StreamTest.php index 30172fbd868..6eea2c7854f 100644 --- a/tests/TestCase/Http/Client/Adapter/StreamTest.php +++ b/tests/TestCase/Http/Client/Adapter/StreamTest.php @@ -182,7 +182,7 @@ public function testBuildingContextHeader() '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']); }