Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.3

Bug #8006 readLeftOver causing problems with HTTP_Server
Submitted: 2006-06-26 11:28 UTC Modified: 2006-06-27 09:51 UTC
From: erudd at netfor dot com Assigned: cweiske
Status: Closed Package: Net_Server (version 1.0.0)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2006-06-26 11:28 UTC] erudd at netfor dot com (Edward Rudd)
Description: ------------ the new readLeftOver feature in Net_Server 1.0.0 is causing problems with HTTP_Server when using (at least) the sequential driver. The problem that is occuring is the "end" of a previous request is appearing in the beginning of the next request and causing HTTP_Server to fail to find the initial GET line of the HTTP request as any trailing \r\ns from the previous request appear in the beginning of the new un-related request. What is the intended reasoning for the readLeftOver feature?? And shouldn't it be cleared upon client disconnect?

Comments

 [2006-06-26 12:02 UTC] erudd at netfor dot com
Patch to fix of of the underlying issues. The length of readEndCharacter (which with HTTP_Server is 4 characters not 1). was not taken into account when appending the endCharacter to $data. also when checking for leftover parts, readEndCharacter was not taken into account at all. --- Net_Server-1.0.0/Server/Driver.php.orig 2006-06-26 12:57:38.000000000 -0400 +++ Net_Server-1.0.0/Server/Driver.php 2006-06-26 12:57:49.000000000 -0400 @@ -232,8 +233,8 @@ if ($posEndChar === false) { $data .= $buf; } else { - $data .= substr($buf, 0, $posEndChar + 1); - if ($posEndChar < strlen($buf)) { + $data .= substr($buf, 0, $posEndChar + strlen($this->readEndCharacter)); + if (($posEndChar + strlen($this->readEndCharacter)) < strlen($buf)) { $this->_readLeftOver = substr($buf, $posEndChar + 1); } break;
 [2006-06-27 05:02 UTC] cweiske (Christian Weiske)
readLeftOver is needed when the sever gets hammered with some 100 requests/second. Then it occurs that two requests get delivered to the same connection, making it necessary to split them. I'm about to fix it, but it's not as easy as your patch does it.
 [2006-06-27 05:42 UTC] cweiske (Christian Weiske)
Thank you for taking the time to report a problem with the package. This problem may have been already fixed by a previous change that is in the CVS of the package. Please log into CVS with: cvs -d :pserver:cvsread@cvs.php.net:/repository login and check out the CVS repository of this package and upgrade cvs -d :pserver:cvsread@cvs.php.net:/repository co pear/Net_Server pear upgrade pear/Net_Server/package2.xml or pear upgrade pear/Net_Server/package.xml If you are able to reproduce the bug with the latest CVS, please change the status back to "Open". Again, thank you for your continued support of PEAR.
 [2006-06-27 09:51 UTC] erudd at netfor dot com
Thanks. CVS HEAD works. When the 1.0.1 release gets out I can finally drop all my "kludges, patches and workarounds" in my code.