cvs: php4 /pear/Net Socket.php
| From: | Chuck Hagenbuch | Date: | Mon, 10 Sep 2001 15:58:45 +0000 |
| Subject: | cvs: php4 /pear/Net Socket.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-828@lists.php.net to get a copy of this message | ||
chagenbu Mon Sep 10 11:58:45 2001 EDT
Modified files:
/php4/pear/Net Socket.php
Log:
allow for reading from sockets that just terminate lines with \n, instead of
\r\n. Contributed by Aaron S. Hawley <Aaron.Hawley@uvm.edu>.
Index: php4/pear/Net/Socket.php
diff -u php4/pear/Net/Socket.php:1.7 php4/pear/Net/Socket.php:1.8
--- php4/pear/Net/Socket.php:1.7 Tue Jun 19 11:30:40 2001
+++ php4/pear/Net/Socket.php Mon Sep 10 11:58:45 2001
@@ -17,7 +17,7 @@
// | Chuck Hagenbuch <chuck@horde.org> |
// +----------------------------------------------------------------------+
//
-// $Id: Socket.php,v 1.7 2001/06/19 15:30:40 jon Exp $
+// $Id: Socket.php,v 1.8 2001/09/10 15:58:45 chagenbu Exp $
//
require_once 'PEAR.php';
@@ -291,9 +291,11 @@
$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);
+ if (strlen($line) >= 2 &&
+ (substr($line, -2) == "\r\n" ||
+ substr($line, -1) == "\n")) {
+ return rtrim($line);
+ }
}
return $line;
}