PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Networking » Net_Server » Bug #8006

readLeftOver causing problems with HTTP_Server

Details

Submitted2006-06-26 16:28 UTC
Fromerudd at netfor dot com
Assignedcweiske
StatusClosed
PackageNet_Server
PHP VersionIrrelevant
Roadmaps(Not assigned)

Comments

[2006-06-26 16:28 UTC] erudd at netfor dot com

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?

[2006-06-26 17: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 14: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.