|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-10-02 09:21 UTC] mike@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: mike
[2013-10-02 09:21 UTC] mike@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 13:00:02 2025 UTC |
Description: ------------ in function php_stream_url_wrap_http_ex has some codes like : -------------------------------------- ext/standard/http_fopen_wrapper.c php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context, int redirect_max, int flags STREAMS_DC TSRMLS_DC) /* {{{ */ { ... if (*e != '\n') { do { /* partial header */ php_stream_get_line(stream, http_header_line, HTTP_HEADER_BLOCK_SIZE, &http_header_line_length); e = http_header_line + http_header_line_length - 1; } while (*e != '\n'); continue; } ... } ----------------------------------------------------------------- in this code block , it not check the result of php_stream_get_line(...) ; if the stream lost connect at this time ,and the http header line not end ,then it will be cycle forever. Test script: --------------- ------------------- server.php <?php $str = "HTTP/1.1 200 OK Date: Sat, 07 Jul 2012 07:46:29 GMT"; fgets(STDIN); echo $str; exit; ?> ------------------- end ------------------- client.php <?php echo file_get_contents("http://localhost:9090/"); exit; ?> ------------------- end start server.php : #mkfifo /tmp/fifo #nc -l localhost -p 9090 </tmp/fifo | php server.php >/tmp/fifo start client.php : #php client.php now , the client.php will cycle forever Expected result: ---------------- expect return fail Actual result: -------------- the client.php will cycle forever