diff --git a/src/Client/Adapter/Curl.php b/src/Client/Adapter/Curl.php index a0f8a53646..61e03520ad 100644 --- a/src/Client/Adapter/Curl.php +++ b/src/Client/Adapter/Curl.php @@ -494,7 +494,7 @@ public function write($method, $uri, $httpVersion = 1.1, $headers = [], $body = // cURL automatically handles Proxy rewrites, remove the "HTTP/1.0 200 Connection established" string: $responseHeaders = preg_replace( - "/HTTP\/1.0\s*200\s*Connection\s*established\\r\\n\\r\\n/", + "/HTTP\/1.[01]\s*200\s*Connection\s*established\\r\\n\\r\\n/", '', $responseHeaders ); diff --git a/test/Client/CurlTest.php b/test/Client/CurlTest.php index 6dc81a3fc2..a16b5f12d1 100644 --- a/test/Client/CurlTest.php +++ b/test/Client/CurlTest.php @@ -524,4 +524,24 @@ public function testTimeoutWithStream() } $this->assertNotNull($error, 'Failed to detect timeout in cURL adapter'); } + + /** + * @see https://github.com/zendframework/zend-http/pull/184 + * + */ + public function testMustRemoveProxyConnectionEstablishedLine() + { + $this->client->setUri($this->baseuri . 'testProxyResponse.php'); + + $adapter = new Adapter\Curl(); + + $this->client->setAdapter($adapter); + $this->client->setMethod('GET'); + $this->client->send(); + + $response = $this->client->getResponse(); + + $this->assertEquals(200, $response->getStatusCode()); + $this->assertEquals('work', $response->getBody()); + } } diff --git a/test/Client/_files/testProxyResponse.php b/test/Client/_files/testProxyResponse.php new file mode 100644 index 0000000000..47efb06a30 --- /dev/null +++ b/test/Client/_files/testProxyResponse.php @@ -0,0 +1,8 @@ +