HTTP wrapper is very slow with protocol_version 1.1
| Bug #65634 | HTTP wrapper is very slow with protocol_version 1.1 | ||||
|---|---|---|---|---|---|
| Submitted: | 2013-09-08 16:27 UTC | Modified: | 2013-09-11 21:17 UTC | ||
| From: | butesa at freenet dot de | Assigned: | aharvey (profile) | ||
| Status: | Closed | Package: | HTTP related | ||
| PHP Version: | 5.5.3 | OS: | Ubuntu 12.04 x64 | ||
| Private report: | No | CVE-ID: | None | ||
[2013-09-08 16:27 UTC] 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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2013-09-09 23:03 UTC] aharvey@php.net
[2013-09-09 23:52 UTC] butesa at freenet dot de
[2013-09-10 19:43 UTC] butesa at freenet dot de
[2013-09-11 20:30 UTC] aharvey@php.net
-Status: Not a bug +Status: Assigned -Assigned To: +Assigned To: aharvey
[2013-09-11 20:30 UTC] aharvey@php.net
[2014-05-28 12:46 UTC] Andy_Schmidt at HM-Software dot com
[2015-07-10 13:21 UTC] spam2 at rhsoft dot net