The stream system assumes that the callee always wants to consume *exactly* as much data as the callee is specifying.
This is not the case with sockets where read/recv specify the *maximum* amount of data to read. I've verified that PHP 4.3 behaves like earlier versions with the attached patch. The current socket-over-streams implementation fails to work in the default blocking case. Wez, please let me know what you think about this patch. - Sascha
? difx Index: network.c =================================================================== RCS file: /repository/php4/main/network.c,v retrieving revision 1.70 diff -u -r1.70 network.c --- network.c 28 Sep 2002 22:12:23 -0000 1.70 +++ network.c 4 Oct 2002 13:39:36 -0000 @@ -923,7 +923,8 @@ NULL, /* seek */ php_sockop_cast, php_sockop_stat, - php_sockop_set_option + php_sockop_set_option, + 1 }; Index: php_streams.h =================================================================== RCS file: /repository/php4/main/php_streams.h,v retrieving revision 1.51 diff -u -r1.51 php_streams.h --- php_streams.h 28 Sep 2002 22:10:47 -0000 1.51 +++ php_streams.h 4 Oct 2002 13:39:37 -0000 @@ -153,6 +153,7 @@ int (*cast)(php_stream *stream, int castas, void **ret TSRMLS_DC); int (*stat)(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC); int (*set_option)(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC); + int dont_block; } php_stream_ops; typedef struct _php_stream_wrapper_ops { Index: streams.c =================================================================== RCS file: /repository/php4/main/streams.c,v retrieving revision 1.89 diff -u -r1.89 streams.c --- streams.c 3 Oct 2002 16:06:41 -0000 1.89 +++ streams.c 4 Oct 2002 13:39:38 -0000 @@ -494,7 +494,11 @@ if (justread <= 0) break; + stream->writepos += justread; + + if (stream->ops->dont_block) + break; } }
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php