Re: [PHP] Re: Slow file download
Ashley Sheridan wrote: On Tue, 2008-12-02 at 21:13 +, Nathan Rixham wrote: Nathan Rixham wrote: Brian Dunning wrote: IIS, Windows PHP 5.2.6, and unfortunately the downloads are https. On Dec 2, 2008, at 12:32 PM, Nathan Rixham wrote: what's the server running? iis/apache, win/linux version of php (as accurate as you can) oh and via http or https/ssl? now I may be wrong but I'm rather sure that IIS has a bug where it doesn't close http connections properly, thus you're connection isn't closing until it times out (even though download finished ages ago). doesn't close HTTPS/SSL connections properly - key typo there! I did hear something about that too, and also, not too sure, but think it might have been fixed in later versions of IIS, but, don't quote me on that! Ash www.ashleysheridan.co.uk they might have, either way I'm pretty sure this isn't a download speed but rather a connection not getting closed / eof not being detected type error so the timeout of 20mins+download time is being hit; hopefully a drop in timeout to 5/10 seconds will sort it. will be interested to hear if this is the cause or not! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Slow file download
On Tue, 2008-12-02 at 21:13 +, Nathan Rixham wrote: > Nathan Rixham wrote: > > Brian Dunning wrote: > >> IIS, Windows PHP 5.2.6, and unfortunately the downloads are https. > >> > >> On Dec 2, 2008, at 12:32 PM, Nathan Rixham wrote: > >> > >>> what's the server running? iis/apache, win/linux version of php (as > >>> accurate as you can) oh and via http or https/ssl? > > > > now I may be wrong but I'm rather sure that IIS has a bug where it > > doesn't close http connections properly, thus you're connection isn't > > closing until it times out (even though download finished ages ago). > > doesn't close HTTPS/SSL connections properly - key typo there! > I did hear something about that too, and also, not too sure, but think it might have been fixed in later versions of IIS, but, don't quote me on that! Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Slow file download
On Tue, 2008-12-02 at 21:10 +, Nathan Rixham wrote: > Brian Dunning wrote: > > IIS, Windows PHP 5.2.6, and unfortunately the downloads are https. > > > > On Dec 2, 2008, at 12:32 PM, Nathan Rixham wrote: > > > >> what's the server running? iis/apache, win/linux version of php (as > >> accurate as you can) oh and via http or https/ssl? > > now I may be wrong but I'm rather sure that IIS has a bug where it > doesn't close http connections properly, thus you're connection isn't > closing until it times out (even though download finished ages ago). > > There's some notes on the php site about it but can't seem to spot them > at the minute.. > > if memory serves me correctly lowering that timeout to something like 5 > seconds will do the trick / or using a manual conenction like.. > > $protocol = 'ssl://'; > $server = 'yoursite.com'; > $port = 443; // ssl port? > $context = // your context here > $rawHttpResponse = ''; > > $rawHttpRequest = "GET /file.ext HTTP/1.1\r\nHost: " . $server . "\r\n"; > $rawHttpRequest .= "Connection: Close\r\n\r\n'; > > if( $fp = stream_socket_client($protocol.$server.':'.$port], $errno, > $errstr, 5, STREAM_CLIENT_CONNECT, $context) ) { >fwrite($fp, $rawHttpRequest); >stream_set_timeout($fp, 10); >while (!feof($fp)) { > $a = stream_get_meta_data($fp); > if($a['timed_out']) { >return false; //timed out > } > $rawHttpResponse .= fgets($fp, 2); >} >fclose($fp); > } > echo $rawHttpResponse . PHP_EOL; > ?> > > totally untested :p > > best of luck! > I'm fair sure I hear of more bugs in IIS than I've ever heard of with Apache... *insert obvious troll disclaimer here* Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Slow file download
Nathan Rixham wrote: Brian Dunning wrote: IIS, Windows PHP 5.2.6, and unfortunately the downloads are https. On Dec 2, 2008, at 12:32 PM, Nathan Rixham wrote: what's the server running? iis/apache, win/linux version of php (as accurate as you can) oh and via http or https/ssl? now I may be wrong but I'm rather sure that IIS has a bug where it doesn't close http connections properly, thus you're connection isn't closing until it times out (even though download finished ages ago). doesn't close HTTPS/SSL connections properly - key typo there! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Slow file download
Brian Dunning wrote: IIS, Windows PHP 5.2.6, and unfortunately the downloads are https. On Dec 2, 2008, at 12:32 PM, Nathan Rixham wrote: what's the server running? iis/apache, win/linux version of php (as accurate as you can) oh and via http or https/ssl? now I may be wrong but I'm rather sure that IIS has a bug where it doesn't close http connections properly, thus you're connection isn't closing until it times out (even though download finished ages ago). There's some notes on the php site about it but can't seem to spot them at the minute.. if memory serves me correctly lowering that timeout to something like 5 seconds will do the trick / or using a manual conenction like.. if( $fp = stream_socket_client($protocol.$server.':'.$port], $errno, $errstr, 5, STREAM_CLIENT_CONNECT, $context) ) { fwrite($fp, $rawHttpRequest); stream_set_timeout($fp, 10); while (!feof($fp)) { $a = stream_get_meta_data($fp); if($a['timed_out']) { return false; //timed out } $rawHttpResponse .= fgets($fp, 2); } fclose($fp); } echo $rawHttpResponse . PHP_EOL; ?> totally untested :p best of luck! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Slow file download
IIS, Windows PHP 5.2.6, and unfortunately the downloads are https. On Dec 2, 2008, at 12:32 PM, Nathan Rixham wrote: what's the server running? iis/apache, win/linux version of php (as accurate as you can) oh and via http or https/ssl? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php