Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit d4e4dc4

Browse files
committed
Merge branch 'hotfix/184' into develop
Forward port #184
2 parents cd002e8 + c65c10d commit d4e4dc4

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ All notable changes to this project will be documented in this file, in reverse
4444

4545
### Fixed
4646

47-
- Nothing.
47+
- [#184](https://github.com/zendframework/zend-http/pull/184) fixes responses for request through the proxy with `HTTP/1.1 200 Connection established` header.
4848

4949
## 2.10.0 - 2019-02-19
5050

src/Client/Adapter/Curl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ public function write($method, $uri, $httpVersion = 1.1, $headers = [], $body =
494494

495495
// cURL automatically handles Proxy rewrites, remove the "HTTP/1.0 200 Connection established" string:
496496
$responseHeaders = preg_replace(
497-
"/HTTP\/1.0\s*200\s*Connection\s*established\\r\\n\\r\\n/",
497+
"/HTTP\/1.[01]\s*200\s*Connection\s*established\\r\\n\\r\\n/",
498498
'',
499499
$responseHeaders
500500
);

test/Client/CurlTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,4 +514,24 @@ public function testTimeoutWithStream()
514514
}
515515
$this->assertNotNull($error, 'Failed to detect timeout in cURL adapter');
516516
}
517+
518+
/**
519+
* @see https://github.com/zendframework/zend-http/pull/184
520+
*
521+
*/
522+
public function testMustRemoveProxyConnectionEstablishedLine()
523+
{
524+
$this->client->setUri($this->baseuri . 'testProxyResponse.php');
525+
526+
$adapter = new Adapter\Curl();
527+
528+
$this->client->setAdapter($adapter);
529+
$this->client->setMethod('GET');
530+
$this->client->send();
531+
532+
$response = $this->client->getResponse();
533+
534+
$this->assertEquals(200, $response->getStatusCode());
535+
$this->assertEquals('work', $response->getBody());
536+
}
517537
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
echo "HTTP/1.1 200 Connection established\r\n\r\n";
4+
echo "HTTP/1.1 200 OK\r\n";
5+
echo "content-type: text/plain;charset=UTF-8\r\n";
6+
echo "server: Server\r\n";
7+
echo "\r\n";
8+
echo "work";

0 commit comments

Comments
 (0)