rasmus                                   Fri, 05 Feb 2010 18:59:05 +0000

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

Log:
Fix bug #50940

Bug: http://bugs.php.net/50940 (Open) All Apache SAPI sets content length wrong
      
Changed paths:
    U   php/php-src/branches/PHP_5_2/NEWS
    U   php/php-src/branches/PHP_5_2/sapi/apache/mod_php5.c
    U   php/php-src/branches/PHP_5_2/sapi/apache2filter/sapi_apache2.c
    U   php/php-src/branches/PHP_5_2/sapi/apache2handler/sapi_apache2.c
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/sapi/apache/mod_php5.c
    U   php/php-src/branches/PHP_5_3/sapi/apache2filter/sapi_apache2.c
    U   php/php-src/branches/PHP_5_3/sapi/apache2handler/sapi_apache2.c
    U   php/php-src/trunk/sapi/apache/mod_php.c
    U   php/php-src/trunk/sapi/apache2filter/sapi_apache2.c
    U   php/php-src/trunk/sapi/apache2handler/sapi_apache2.c

Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS   2010-02-05 17:46:33 UTC (rev 294570)
+++ php/php-src/branches/PHP_5_2/NEWS   2010-02-05 18:59:05 UTC (rev 294571)
@@ -5,6 +5,8 @@
 - Fixed a possible open_basedir/safe_mode bypass in session extension
   identified by Grzegorz Stachowiak. (Ilia)

+- Fixed bug #50940 Custom content-length set incorrectly in Apache sapis.
+  (Brian France, Rasmus)
 - Fixed bug #50847 (strip_tags() removes all tags greater then 1023 bytes
   long). (Ilia)
 - Fixed bug #50727 (Accessing mysqli->affected_rows on no connection causes

Modified: php/php-src/branches/PHP_5_2/sapi/apache/mod_php5.c
===================================================================
--- php/php-src/branches/PHP_5_2/sapi/apache/mod_php5.c 2010-02-05 17:46:33 UTC 
(rev 294570)
+++ php/php-src/branches/PHP_5_2/sapi/apache/mod_php5.c 2010-02-05 18:59:05 UTC 
(rev 294571)
@@ -191,6 +191,8 @@

        if (!strcasecmp(header_name, "Content-Type")) {
                r->content_type = pstrdup(r->pool, header_content);
+       } else if (!strcasecmp(header_name, "Content-Length")) {
+               ap_set_content_length(r, strtol(header_content, (char **)NULL, 
10));
        } else if (!strcasecmp(header_name, "Set-Cookie")) {
                table_add(r->headers_out, header_name, header_content);
        } else if (sapi_header->replace) {

Modified: php/php-src/branches/PHP_5_2/sapi/apache2filter/sapi_apache2.c
===================================================================
--- php/php-src/branches/PHP_5_2/sapi/apache2filter/sapi_apache2.c      
2010-02-05 17:46:33 UTC (rev 294570)
+++ php/php-src/branches/PHP_5_2/sapi/apache2filter/sapi_apache2.c      
2010-02-05 18:59:05 UTC (rev 294571)
@@ -116,6 +116,8 @@

        if (!strcasecmp(sapi_header->header, "content-type"))
                ctx->r->content_type = apr_pstrdup(ctx->r->pool, val);
+       else if (!strcasecmp(sapi_header->header, "content-length"))
+               ap_set_content_length(ctx->r, strtol(val, (char **)NULL, 10));
        else if (sapi_header->replace)
                apr_table_set(ctx->r->headers_out, sapi_header->header, val);
        else

Modified: php/php-src/branches/PHP_5_2/sapi/apache2handler/sapi_apache2.c
===================================================================
--- php/php-src/branches/PHP_5_2/sapi/apache2handler/sapi_apache2.c     
2010-02-05 17:46:33 UTC (rev 294570)
+++ php/php-src/branches/PHP_5_2/sapi/apache2handler/sapi_apache2.c     
2010-02-05 18:59:05 UTC (rev 294571)
@@ -109,6 +109,8 @@
                        efree(ctx->content_type);
                }
                ctx->content_type = estrdup(val);
+       } else if (!strcasecmp(sapi_header->header, "content-length")) {
+               ap_set_content_length(ctx->r, strtol(val, (char **)NULL, 10));
        } else if (sapi_header->replace) {
                apr_table_set(ctx->r->headers_out, sapi_header->header, val);
        } else {

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-02-05 17:46:33 UTC (rev 294570)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-02-05 18:59:05 UTC (rev 294571)
@@ -23,6 +23,8 @@
   links or invalid paths. (Pierre)
 - Fixed error output to stderr on Windows. (Pierre)

+- Fixed bug #50940 Custom content-length set incorrectly in Apache sapis.
+  (Brian France, Rasmus)
 - Fixed bug #50907 (X-PHP-Originating-Script adding two new lines in *NIX).
   (Ilia)
 - Fixed bug #50859 (build fails with openssl 1.0 due to md2 deprecation).

Modified: php/php-src/branches/PHP_5_3/sapi/apache/mod_php5.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/apache/mod_php5.c 2010-02-05 17:46:33 UTC 
(rev 294570)
+++ php/php-src/branches/PHP_5_3/sapi/apache/mod_php5.c 2010-02-05 18:59:05 UTC 
(rev 294571)
@@ -196,6 +196,8 @@

                        if (!strcasecmp(header_name, "Content-Type")) {
                                r->content_type = pstrdup(r->pool, 
header_content);
+                       } else if (!strcasecmp(header_name, "Content-Length")) {
+                               ap_set_content_length(r, strtol(header_content, 
(char **)NULL, 10));
                        } else if (!strcasecmp(header_name, "Set-Cookie")) {
                                table_add(r->headers_out, header_name, 
header_content);
                        } else if (op == SAPI_HEADER_REPLACE) {

Modified: php/php-src/branches/PHP_5_3/sapi/apache2filter/sapi_apache2.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/apache2filter/sapi_apache2.c      
2010-02-05 17:46:33 UTC (rev 294570)
+++ php/php-src/branches/PHP_5_3/sapi/apache2filter/sapi_apache2.c      
2010-02-05 18:59:05 UTC (rev 294571)
@@ -127,6 +127,8 @@

                        if (!strcasecmp(sapi_header->header, "content-type"))
                                ctx->r->content_type = 
apr_pstrdup(ctx->r->pool, val);
+                       else if (!strcasecmp(sapi_header->header, 
"content-length"))
+                               ap_set_content_length(ctx->r, strtol(val, (char 
**)NULL, 10));
                        else if (op == SAPI_HEADER_REPLACE)
                                apr_table_set(ctx->r->headers_out, 
sapi_header->header, val);
                        else

Modified: php/php-src/branches/PHP_5_3/sapi/apache2handler/sapi_apache2.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/apache2handler/sapi_apache2.c     
2010-02-05 17:46:33 UTC (rev 294570)
+++ php/php-src/branches/PHP_5_3/sapi/apache2handler/sapi_apache2.c     
2010-02-05 18:59:05 UTC (rev 294571)
@@ -119,6 +119,8 @@
                                        efree(ctx->content_type);
                                }
                                ctx->content_type = estrdup(val);
+                       } else if (!strcasecmp(sapi_header->header, 
"content-length")) {
+                               ap_set_content_length(ctx->r, strtol(val, (char 
**)NULL, 10));
                        } else if (op == SAPI_HEADER_REPLACE) {
                                apr_table_set(ctx->r->headers_out, 
sapi_header->header, val);
                        } else {

Modified: php/php-src/trunk/sapi/apache/mod_php.c
===================================================================
--- php/php-src/trunk/sapi/apache/mod_php.c     2010-02-05 17:46:33 UTC (rev 
294570)
+++ php/php-src/trunk/sapi/apache/mod_php.c     2010-02-05 18:59:05 UTC (rev 
294571)
@@ -196,6 +196,8 @@

                        if (!strcasecmp(header_name, "Content-Type")) {
                                r->content_type = pstrdup(r->pool, 
header_content);
+                       } else if (!strcasecmp(header_name, "Content-Length")) {
+                               ap_set_content_length(r, strtol(header_content, 
(char **)NULL, 10));
                        } else if (!strcasecmp(header_name, "Set-Cookie")) {
                                table_add(r->headers_out, header_name, 
header_content);
                        } else if (op == SAPI_HEADER_REPLACE) {

Modified: php/php-src/trunk/sapi/apache2filter/sapi_apache2.c
===================================================================
--- php/php-src/trunk/sapi/apache2filter/sapi_apache2.c 2010-02-05 17:46:33 UTC 
(rev 294570)
+++ php/php-src/trunk/sapi/apache2filter/sapi_apache2.c 2010-02-05 18:59:05 UTC 
(rev 294571)
@@ -127,6 +127,8 @@

                        if (!strcasecmp(sapi_header->header, "content-type"))
                                ctx->r->content_type = 
apr_pstrdup(ctx->r->pool, val);
+                       else if (!strcasecmp(sapi_header->header, 
"content-length"))
+                               ap_set_content_length(ctx->r, strtol(val, (char 
**)NULL, 10));
                        else if (op == SAPI_HEADER_REPLACE)
                                apr_table_set(ctx->r->headers_out, 
sapi_header->header, val);
                        else

Modified: php/php-src/trunk/sapi/apache2handler/sapi_apache2.c
===================================================================
--- php/php-src/trunk/sapi/apache2handler/sapi_apache2.c        2010-02-05 
17:46:33 UTC (rev 294570)
+++ php/php-src/trunk/sapi/apache2handler/sapi_apache2.c        2010-02-05 
18:59:05 UTC (rev 294571)
@@ -119,6 +119,8 @@
                                        efree(ctx->content_type);
                                }
                                ctx->content_type = estrdup(val);
+                       } else if (!strcasecmp(sapi_header->header, 
"content-length")) {
+                               ap_set_content_length(ctx->r, strtol(val, (char 
**)NULL, 10));
                        } else if (op == SAPI_HEADER_REPLACE) {
                                apr_table_set(ctx->r->headers_out, 
sapi_header->header, val);
                        } else {

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

Reply via email to