php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #27814 Multiple small packets send for HTTP request
Submitted: 2004-03-31 14:48 UTC Modified: 2016-08-04 13:43 UTC
Votes:8
Avg. Score:4.1 ± 0.9
Reproduced:5 of 5 (100.0%)
Same Version:2 (40.0%)
Same OS:2 (40.0%)
From: Olaf at XCC dot TMFWeb dot NL Assigned: nikic (profile)
Status: Closed Package: Streams related
PHP Version: * OS: *
Private report: No CVE-ID: None
 [2004-03-31 14:48 UTC] Olaf at XCC dot TMFWeb dot NL
Description:
------------
This code sends two packets, one of 16 bytes and one of 17 bytes.

I guess this is caused by multiple calls to php_stream_write in
http_fopen_wrapper.c: php_stream_url_wrap_http_ex

Preparing the entire request in one buffer and sending it via one call should produce less packets (and be faster).

Reproduce code:
---------------
<?php
	echo strlen(file_get_contents("http://php.net/"));
?>

Expected result:
----------------
One packet of 33 bytes.

Actual result:
--------------
Two packets.

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-31 17:55 UTC] wez@php.net
You're correct; there is no write buffering for the http
request.
 [2004-04-19 03:02 UTC] OvdSpek at LIACS dot NL
Will a buffer be added?
 [2004-04-19 06:38 UTC] pollita@php.net
It's too late for the 5.0 branch (which is in final RC stage), but it's under consideration for the 5.1 branch.
 [2005-07-29 18:21 UTC] sniper@php.net
Still considering after over a year or is this fixed by now?
(should this actually be a feature request?)

 [2008-03-07 00:01 UTC] a dot u dot savchuk at gmail dot com
Problem still exists.

tcpdump shows during execution test example
that 'GET ...' and 'Host ...' are sent by multiple packets:
---------
000110 IP (tos 0x0, ttl  64, id 62602, offset 0, flags [DF], proto 6, length: 68) x.x.x.x.42720 > 69.147.83.197.80: P [tcp
 sum ok] 1:17(16) ack 1 win 1460 <nop,nop,timestamp 339227911 3473916863>
E..D..@.@...
.       FE.S....P.....,.D...........
.85.....GET / HTTP/1.0

101682 IP (tos 0x0, ttl  57, id 8438, offset 0, flags [DF], proto 6, length: 52) 69.147.83.197.80 > x.x.x.x.42720: . [tcp
sum ok] 1:1(0) ack 17 win 33296 <nop,nop,timestamp 3473916965 339227911>
E..4 .@.9.sTE.S.
.       F.P...,.D........,z.....

        ...%.85.
000024 IP (tos 0x0, ttl  64, id 62603, offset 0, flags [DF], proto 6, length: 69) x.x.x.x.42720 > 69.147.83.197.80: P [tcp
 sum ok] 17:34(17) ack 1 win 1460 <nop,nop,timestamp 339227937 3473916965>
E..E..@.@...
.       FE.S....P.....,.D...........
.85!...%Host: php.net



013718 IP (tos 0x0, ttl  57, id 61609, offset 0, flags [DF], proto 6, length: 1500) 69.147.83.197.80 > x.x.x.x.42720: . 1:
1449(1448) ack 34 win 33304 <nop,nop,timestamp 3473916977 339227937>
E.....@.9...E.S.
.       F.P...,.D........,_.....
...1.85!HTTP/1.1 200 OK
D
        ate: Fri, 07
---------
 [2010-12-20 13:59 UTC] jani@php.net
-Package: Feature/Change Request +Package: Streams related -PHP Version: 5.1* +PHP Version: *
 [2012-07-30 10:10 UTC] olivier dot parmentier at cellfishmedia dot fr
using 5.2.17 and 5.3.3
if needed I can test on newer version but it doesn't seems anything was done 
about it.

the problem is still there.
it's a HUGE probleme when using IPSec VPN as the overhead can be tremendous with 
lots of small packets.

It's not a theoretical problem. for me It's a real one that affect the business 
with our partner.

anything new on the subject ? Anything I can do ?
 [2013-12-13 07:42 UTC] wez@php.net
-Status: Assigned +Status: Open
 [2013-12-13 07:43 UTC] wez@php.net
-Status: Assigned +Status: Open -Assigned To: wez +Assigned To:
 [2016-08-04 13:07 UTC] vhu at iki dot fi
Related to bug #53615
 [2016-08-04 13:43 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC