From: Ilia Alshanetsky Date: Sun, 20 Dec 2009 19:14:30 +0000 (+0000) Subject: MFH: Fixed bug #49851 (http wrapper breaks on 1024 char long headers). X-Git-Tag: php-5.2.13RC1~92 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d70269771397a7253abc098e6b72f40c28910b88;p=php MFH: Fixed bug #49851 (http wrapper breaks on 1024 char long headers). --- diff --git a/NEWS b/NEWS index 61ffd855d2..132cbbd01c 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ PHP NEWS - Fixed bug #50508 (compile failure: Conflicting HEADER type declarations). (Jani) - Fixed bug #50394 (Reference argument converted to value in __call). (Stas) +- Fixed bug #49851 (http wrapper breaks on 1024 char long headers). (Ilia) 17 Dec 2009, PHP 5.2.12 diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 3777505d70..242fab461d 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -605,6 +605,13 @@ 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, 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') { + 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; + } while (*e == '\n' || *e == '\r') { e--; }