Bug #70361 [NEW]: HTTP stream wrapper doesn't close keep-alive connections
| From: | me at kelunik dot com | Date: | Tue, 25 Aug 2015 18:04:49 +0000 |
| Subject: | Bug #70361 [NEW]: HTTP stream wrapper doesn't close keep-alive connections | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-195511@lists.php.net to get a copy of this message | ||
From: me at kelunik dot com
Operating system:
PHP version: Irrelevant
Package: Streams related
Bug Type: Bug
Bug description:HTTP stream wrapper doesn't close keep-alive connections
Description:
------------
Downloading a file with
file_get_contents("http://example.com/example.json"); defaults to
using
HTTP/1.0. RFC compliant servers should respond with a HTTP/1.1 in such a
case if they support HTTP/1.1. Some servers initiate a keep-alive
connection in that case, resulting a client hang, because PHP waits
until the connection is closed instead of relying on the Content-Length
header.
This behavior should be fixed in two ways: (1) Always send "Connection:
close" â even for HTTP/1.0 requests â and (2) use Content-Length to
determine the end of a response and close the connection then.
My attached patch only fixes the first point.
Information regarding relevant spec:
http://serverfault.com/a/442978/217277
file_get_contents behavior description:
http://stackoverflow.com/a/4240241/2373138
--
Edit bug report at https://bugs.php.net/bug.php?id=70361&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70361&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70361&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70361&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70361&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70361&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70361&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70361&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70361&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70361&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70361&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70361&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70361&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70361&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70361&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70361&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70361&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70361&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70361&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70361&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70361&r=mysqlcfg