]> granicus.if.org Git - php/commitdiff
(sort of) MFB, feof fix for sockets.
authorWez Furlong <wez@php.net>
Fri, 28 Nov 2003 23:20:23 +0000 (23:20 +0000)
committerWez Furlong <wez@php.net>
Fri, 28 Nov 2003 23:20:23 +0000 (23:20 +0000)
ext/openssl/xp_ssl.c
main/streams/streams.c
main/streams/xp_socket.c

index be5d9afedbac0810965c37d845748aba4878b2f0..9a5732583ed81ed6a153aed636f3b684dc6bcf31 100644 (file)
@@ -437,10 +437,16 @@ static int php_openssl_sockop_set_option(php_stream *stream, int option, int val
                case PHP_STREAM_OPTION_CHECK_LIVENESS:
                        {
                                fd_set rfds;
-                               struct timeval tv = {0,0};
+                               struct timeval tv;
                                char buf;
                                int alive = 1;
 
+                               if (sslsock->s.timeout.tv_sec == -1) {
+                                       tv.tv_sec = FG(default_socket_timeout);
+                               } else {
+                                       tv = sslsock->s.timeout;
+                               }
+
                                if (sslsock->s.socket == -1) {
                                        alive = 0;
                                } else {
index b64cb5bdac7646246ffc87bba4af7d96fc183336..2089281741376fe6691079efe802f2ba8d476fb1 100755 (executable)
@@ -602,6 +602,12 @@ PHPAPI int _php_stream_eof(php_stream *stream TSRMLS_DC)
                return 0;
        }
 
+       if (!stream->eof && PHP_STREAM_OPTION_RETURN_ERR ==
+                       php_stream_set_option(stream, PHP_STREAM_OPTION_CHECK_LIVENESS,
+                       0, NULL)) {
+               stream->eof = 1;
+       }
+
        return stream->eof;
 }
 
@@ -1113,7 +1119,7 @@ PHPAPI int _php_stream_set_option(php_stream *stream, int option, int value, voi
                                break;
                                
                        default:
-                               ret = PHP_STREAM_OPTION_RETURN_ERR;
+                               ;
                }
        }
 
index 55c6990957fcbb9e7ea5366e243070596cb9821b..ae7e8844f6fdbbd2015f3d1e22c4cabafcb3739f 100644 (file)
@@ -203,10 +203,16 @@ static int php_sockop_set_option(php_stream *stream, int option, int value, void
                case PHP_STREAM_OPTION_CHECK_LIVENESS:
                        {
                                fd_set rfds;
-                               struct timeval tv = {0,0};
+                               struct timeval tv;
                                char buf;
                                int alive = 1;
 
+                               if (sock->timeout.tv_sec == -1) {
+                                       tv.tv_sec = FG(default_socket_timeout);
+                               } else {
+                                       tv = sock->timeout;
+                               }
+
                                if (sock->socket == -1) {
                                        alive = 0;
                                } else {