From e77fc29d49d5a3da2fbd1a545364347ecad7cddd Mon Sep 17 00:00:00 2001 From: Dick Marinus Date: Mon, 1 Apr 2013 16:58:20 +0200 Subject: [PATCH] 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 --- src/HPCloud/Transport/PHPStreamTransport.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/HPCloud/Transport/PHPStreamTransport.php b/src/HPCloud/Transport/PHPStreamTransport.php index a940c6f..51f698d 100644 --- a/src/HPCloud/Transport/PHPStreamTransport.php +++ b/src/HPCloud/Transport/PHPStreamTransport.php @@ -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,