It happens in PHP_5_2 as well, why not fix that too? :)

--Jani


On 12/10/2009 05:23 AM, Ilia Alshanetsky wrote:
iliaa                                    Thu, 10 Dec 2009 03:23:05 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=291938

Log:
Fixed bug #49851 (http wrapper breaks on 1024 char long headers).

Bug: http://bugs.php.net/49851 (Open) http wrapper breaks on 1024 char long 
headers

Changed paths:
     U   php/php-src/branches/PHP_5_3/NEWS
     U   php/php-src/branches/PHP_5_3/ext/standard/http_fopen_wrapper.c
     U   php/php-src/trunk/ext/standard/http_fopen_wrapper.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2009-12-10 02:25:47 UTC (rev 291937)
+++ php/php-src/branches/PHP_5_3/NEWS   2009-12-10 03:23:05 UTC (rev 291938)
@@ -95,6 +95,7 @@
  - Fixed bug #49866 (Making reference on string offsets crashes PHP). (Dmitry)
  - Fixed bug #49855 (import_request_variables() always returns NULL). (Ilia,
    sjoerd at php dot net)
+- Fixed bug #49851 (http wrapper breaks on 1024 char long headers). (Ilia)
  - Fixed bug #49800 (SimpleXML allow (un)serialize() calls without warning).
    (Ilia, wmeler at wp-sa dot pl)
  - Fixed bug #49719 (ReflectionClass::hasProperty returns true for a private

Modified: php/php-src/branches/PHP_5_3/ext/standard/http_fopen_wrapper.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/http_fopen_wrapper.c      
2009-12-10 02:25:47 UTC (rev 291937)
+++ php/php-src/branches/PHP_5_3/ext/standard/http_fopen_wrapper.c      
2009-12-10 03:23:05 UTC (rev 291938)
@@ -610,6 +610,10 @@
                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') { /* 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--;
                        }

Modified: php/php-src/trunk/ext/standard/http_fopen_wrapper.c
===================================================================
--- php/php-src/trunk/ext/standard/http_fopen_wrapper.c 2009-12-10 02:25:47 UTC 
(rev 291937)
+++ php/php-src/trunk/ext/standard/http_fopen_wrapper.c 2009-12-10 03:23:05 UTC 
(rev 291938)
@@ -653,6 +653,10 @@
                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--;
                        }




--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to