]> granicus.if.org Git - php/commitdiff
Fixed bug #50451 (http wrapper breaks on 2048 char long headers)
authorIlia Alshanetsky <iliaa@php.net>
Sun, 13 Dec 2009 15:44:22 +0000 (15:44 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 13 Dec 2009 15:44:22 +0000 (15:44 +0000)
# Improvement on the fix for bug #49851

ext/standard/http_fopen_wrapper.c

index 4f5095b72ebde2ac65ffc738e396f44ea0a01395..c400d13132fe86390ed1d8063ceadcdd0945e440 100644 (file)
@@ -653,9 +653,11 @@ 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, ZSTR(http_header_line), HTTP_HEADER_BLOCK_SIZE, &http_header_line_length);
-                               continue;
+                       if (*e != '\n') {
+                               do { /* partial header */
+                                       php_stream_get_line(stream, ZSTR(http_header_line), HTTP_HEADER_BLOCK_SIZE, &http_header_line_length);
+                                       e = http_header_line + http_header_line_length - 1;
+                               } while (*e != '\n');
                        }
                        while (*e == '\n' || *e == '\r') {
                                e--;