wez             Fri Nov 28 17:11:35 2003 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/main       network.c streams.c 
  Log:
  Fix for bug #25939; feof not working correctly for sockets.
  Possibly also fixes #23220; warnings issued by fgets on ssl sockets.
  
  
Index: php-src/main/network.c
diff -u php-src/main/network.c:1.83.2.20 php-src/main/network.c:1.83.2.21
--- php-src/main/network.c:1.83.2.20    Fri Oct 17 07:09:49 2003
+++ php-src/main/network.c      Fri Nov 28 17:11:34 2003
@@ -16,7 +16,7 @@
    | Streams work by Wez Furlong <[EMAIL PROTECTED]>                   |
    +----------------------------------------------------------------------+
  */
-/* $Id: network.c,v 1.83.2.20 2003/10/17 11:09:49 sas Exp $ */
+/* $Id: network.c,v 1.83.2.21 2003/11/28 22:11:34 wez Exp $ */
 
 /*#define DEBUG_MAIN_NETWORK 1*/
 
@@ -1139,8 +1139,14 @@
        int alive = 1;
        int fd = sock->socket;
        fd_set rfds;
-       struct timeval tv = {0, 0};
+       struct timeval tv;
        char buf;
+       
+       if (sock->timeout.tv_sec == -1) {
+               tv.tv_sec = FG(default_socket_timeout);
+       } else {
+               tv = sock->timeout;
+       }
 
        /* logic: if the select call indicates that there is data to
         * be read, but a read returns 0 bytes of data, then the socket
Index: php-src/main/streams.c
diff -u php-src/main/streams.c:1.125.2.83 php-src/main/streams.c:1.125.2.84
--- php-src/main/streams.c:1.125.2.83   Thu Nov 27 19:00:34 2003
+++ php-src/main/streams.c      Fri Nov 28 17:11:34 2003
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: streams.c,v 1.125.2.83 2003/11/28 00:00:34 iliaa Exp $ */
+/* $Id: streams.c,v 1.125.2.84 2003/11/28 22:11:34 wez Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -659,6 +659,10 @@
        if (stream->writepos - stream->readpos > 0)
                return 0;
 
+       if (!stream->eof && php_stream_is(stream, PHP_STREAM_IS_SOCKET)) {
+               stream->eof = !_php_network_is_stream_alive(stream);
+       }
+       
        return stream->eof;
 }
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to