Disable HTTP 1.1 connection keep-alive

As [1] states:
If this value is set to 1.1 it is your responsibility to be 1.1
compliant.

PHP doesn't support Connection: keep-alive and feof will wait until the
timeout of the webserver it reached (5 seconds for Apache).

This patch adds Connection: close to the headers of PHPStreamTransport
to prevent keep-alive for HTTP 1.1 requests.

1. http://www.php.net/manual/en/context.http.php#context.http.protocol-version
This commit is contained in:
Dick Marinus
2013-04-01 16:58:20 +02:00
parent 03f447c9e5
commit e77fc29d49

View File

@@ -234,6 +234,7 @@ class PHPStreamTransport implements Transporter {
*/
protected function buildStreamContext($method, $headers, $body) {
// Construct the stream options.
$headers['Connection'] = 'close';
$config = array(
'http' => array(
'protocol_version' => $this->httpVersion,