Bug #65634 [Opn->Nab]: HTTP wrapper is very slow with protocol_version 1.1
| From: | aharvey@php.net | Date: | Mon, 09 Sep 2013 23:03:47 +0000 |
| Subject: | Bug #65634 [Opn->Nab]: HTTP wrapper is very slow with protocol_version 1.1 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-181499@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65634&edit=1
ID: 65634
Updated by: aharvey@php.net
Reported by: butesa at freenet dot de
Summary: HTTP wrapper is very slow with protocol_version 1.1
-Status: Open
+Status: Not a bug
Type: Bug
Package: HTTP related
Operating System: Ubuntu 12.04 x64
PHP Version: 5.5.3
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
www.google.de responds with a keep-alive connection when a HTTP/1.1 request is
made and no Connection request header is included, which is valid in RFC 2616.
Sending a "Connection: close" request header restores the 1.0 behaviour.
Previous Comments:
------------------------------------------------------------------------
[2013-09-08 16:27:47] butesa at freenet dot de
Description:
------------
Loading a website with the http wrapper takes very long if protocol_version is set to 1.1. The time
it takes depends on the timeout. On some servers the problem doesn't occur.
I tested also on Ubuntu 10.04 (PHP 5.3.2-1ubuntu4.19) and Ubuntu 12.04 (PHP 5.3.10-1ubuntu3.7), both
64bit.
Test script:
---------------
<?php
$url = 'http://www.google.de/intl/de/policies/?fg=1';
foreach(array(1.0,1.1) as $proto)
{
for ($timeout = 1; $timeout < 60; $timeout+=10)
{
$st = microtime(true);
$opt = array(
'http' => array(
'timeout' => $timeout,
'protocol_version' => $proto,
),
);
$context = stream_context_create($opt);
$content = file_get_contents($url,false,$context);
printf("%2d %.1f %f %s\n", $timeout, $proto, microtime(true) - $st, md5($content));
}
}
?>
Expected result:
----------------
The request takes the same time, no matter what timeout and protocol_version is set.
Actual result:
--------------
Output of the test script:
For $url='http://www.google.de/intl/de/policies/?fg=1':
1 1.0 0.279102 60bf7bc72d2a06b337c8a8464e0f9e66
11 1.0 0.277956 60bf7bc72d2a06b337c8a8464e0f9e66
21 1.0 0.283753 60bf7bc72d2a06b337c8a8464e0f9e66
31 1.0 0.285862 60bf7bc72d2a06b337c8a8464e0f9e66
41 1.0 0.277894 60bf7bc72d2a06b337c8a8464e0f9e66
51 1.0 0.285653 60bf7bc72d2a06b337c8a8464e0f9e66
1 1.1 2.284301 60bf7bc72d2a06b337c8a8464e0f9e66
11 1.1 22.305424 60bf7bc72d2a06b337c8a8464e0f9e66
21 1.1 42.309270 60bf7bc72d2a06b337c8a8464e0f9e66
31 1.1 62.355997 60bf7bc72d2a06b337c8a8464e0f9e66
41 1.1 82.360794 60bf7bc72d2a06b337c8a8464e0f9e66
51 1.1 102.379933 60bf7bc72d2a06b337c8a8464e0f9e66
For $url='http://www.example.com':
1 1.0 0.491382 09b9c392dc1f6e914cea287cb6be34b0
11 1.0 0.426191 09b9c392dc1f6e914cea287cb6be34b0
21 1.0 0.428513 09b9c392dc1f6e914cea287cb6be34b0
31 1.0 0.423852 09b9c392dc1f6e914cea287cb6be34b0
41 1.0 0.423751 09b9c392dc1f6e914cea287cb6be34b0
51 1.0 0.431590 09b9c392dc1f6e914cea287cb6be34b0
1 1.1 1.420486 09b9c392dc1f6e914cea287cb6be34b0
11 1.1 6.143113 09b9c392dc1f6e914cea287cb6be34b0
21 1.1 5.994384 09b9c392dc1f6e914cea287cb6be34b0
31 1.1 5.991940 09b9c392dc1f6e914cea287cb6be34b0
41 1.1 6.012121 09b9c392dc1f6e914cea287cb6be34b0
51 1.1 6.007920 09b9c392dc1f6e914cea287cb6be34b0
For $url='http://www.php.net':
1 1.0 1.673016 2dcc6fe85b335205a35d9980a9095735
11 1.0 1.935555 2dcc6fe85b335205a35d9980a9095735
21 1.0 1.648235 2dcc6fe85b335205a35d9980a9095735
31 1.0 1.637566 2dcc6fe85b335205a35d9980a9095735
41 1.0 1.633473 2dcc6fe85b335205a35d9980a9095735
51 1.0 1.718051 2dcc6fe85b335205a35d9980a9095735
1 1.1 1.647803 2dcc6fe85b335205a35d9980a9095735
11 1.1 1.863799 2dcc6fe85b335205a35d9980a9095735
21 1.1 1.673567 2dcc6fe85b335205a35d9980a9095735
31 1.1 1.651704 2dcc6fe85b335205a35d9980a9095735
41 1.1 1.657976 2dcc6fe85b335205a35d9980a9095735
51 1.1 1.635651 2dcc6fe85b335205a35d9980a9095735
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65634&edit=1