[Net/Socket] Bug in writeLine()
| From: | Aaron S. Hawley | Date: | Fri, 07 Sep 2001 23:20:55 +0000 |
| Subject: | [Net/Socket] Bug in writeLine() | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-65399@lists.php.net to get a copy of this message | ||
i will be sending more patches for this package, but wanted to get this
one out of the way first. It supports sockets which are sending new-lines
without carriage-returns. all along i have been thinking i was using the
package incorrectly, or writing bad commands/data to the socket.
thanks,
aaron
*** Socket.php.old Fri Sep 7 18:19:12 2001
--- Socket.php Fri Sep 7 19:13:33 2001
***************
*** 291,299 ****
$timeout = time() + $this->timeout;
while (!feof($this->fp) && (!$this->timeout || time() < $timeout)) {
$line .= fgets($this->fp, $this->lineLength);
! $len = strlen($line);
! if ($len >=2 && substr($line, $len-2, 2) == "\r\n")
! return substr($line, 0, $len-2);
}
return $line;
}
--- 291,301 ----
$timeout = time() + $this->timeout;
while (!feof($this->fp) && (!$this->timeout || time() < $timeout)) {
$line .= fgets($this->fp, $this->lineLength);
! if (strlen($line) >= 2 &&
! (substr($line, -2) == "\r\n" ||
! substr($line, -1) == "\n")) {
! return rtrim($line);
! }
}
return $line;
}
--
__________________________________________
PINE 4.33 Mailer - www.washington.edu/pine