Bug #70361 [Opn->Csd]: HTTP stream wrapper doesn't close keep-alive connections

From: Date: Fri, 04 Sep 2015 14:32:54 +0000
Subject: Bug #70361 [Opn->Csd]: HTTP stream wrapper doesn't close keep-alive connections
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195766@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70361&edit=1 ID: 70361 Updated by: bwoebi@php.net Reported by: me at kelunik dot com Summary: HTTP stream wrapper doesn't close keep-alive connections -Status: Open +Status: Closed Type: Bug Package: Streams related PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Automatic comment on behalf of me@kelunik.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=4b1dff6f438f84f7694df701b68744edbdd86153 Log: Fix #70361: HTTP stream wrapper doesn't close keep-alive connections Previous Comments: ------------------------------------------------------------------------ [2015-08-25 22:05:59] me at kelunik dot com Patch is outdated, PR contains test fixes and NEWS entry. ------------------------------------------------------------------------ [2015-08-25 18:04:48] me at kelunik dot com 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 this bug report at https://bugs.php.net/bug.php?id=70361&edit=1

« previous php.bugs (#195766) next »