Bug #63338 [Opn->Csd]: php_stream_url_wrap_http_ex() function
| From: | mike@php.net | Date: | Wed, 02 Oct 2013 09:21:09 +0000 |
| Subject: | Bug #63338 [Opn->Csd]: php_stream_url_wrap_http_ex() function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-181944@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63338&edit=1
ID: 63338
Updated by: mike@php.net
Reported by: phpor dot net at gmail dot com
Summary: php_stream_url_wrap_http_ex() function
-Status: Open
+Status: Closed
Type: Bug
Package: HTTP related
Operating System: all
PHP Version: 5.4.8
-Assigned To:
+Assigned To: mike
Block user comment: N
Private report: N
New Comment:
Fixed in recent versions.
Previous Comments:
------------------------------------------------------------------------
[2012-10-23 08:50:19] phpor dot net at gmail dot com
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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63338&edit=1