From: Ilia Alshanetsky Date: Thu, 10 Dec 2009 03:23:05 +0000 (+0000) Subject: Fixed bug #49851 (http wrapper breaks on 1024 char long headers). X-Git-Tag: php-5.4.0alpha1~191^2~2253 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b9db7b42821e8975a8de27f6a4e727194091fdc1;p=php Fixed bug #49851 (http wrapper breaks on 1024 char long headers). --- diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 630976b90a..23565652cb 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -653,6 +653,10 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, size_t http_header_line_length; if (php_stream_get_line(stream, ZSTR(http_header_line), HTTP_HEADER_BLOCK_SIZE, &http_header_line_length) && *http_header_line != '\n' && *http_header_line != '\r') { char *e = http_header_line + http_header_line_length - 1; + if (*e != '\n') { /* partial header */ + php_stream_get_line(stream, http_header_line, HTTP_HEADER_BLOCK_SIZE, &http_header_line_length); + continue; + } while (*e == '\n' || *e == '\r') { e--; }