]> granicus.if.org Git - php/commitdiff
Fix bug #50940
authorRasmus Lerdorf <rasmus@php.net>
Fri, 5 Feb 2010 18:59:05 +0000 (18:59 +0000)
committerRasmus Lerdorf <rasmus@php.net>
Fri, 5 Feb 2010 18:59:05 +0000 (18:59 +0000)
NEWS
sapi/apache/mod_php5.c
sapi/apache2filter/sapi_apache2.c
sapi/apache2handler/sapi_apache2.c

diff --git a/NEWS b/NEWS
index c9d9f385c24dd3405b77683d9245f7e9cf2006fb..428bf72025f8b18e59c9d9ca55c10be2839091cc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ PHP                                                                        NEWS
 - 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
index 3c61678dca065ad6bd890ed3227a9a63884cd774..cf458456c6c38c4b5543f7df4b2eff2b6ac09f18 100644 (file)
@@ -191,6 +191,8 @@ static int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_head
 
        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) {
index b8f3e89dc87175b11f94f743a0fee91165919f58..ec89f404d1e560ff7835df763646f14f15040ab0 100644 (file)
@@ -116,6 +116,8 @@ php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_str
 
        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
index bd977c76ca8dbe44117a1128b402c7e5117d20cd..0829c2619e0edad650176bbf82637b622765ba81 100644 (file)
@@ -109,6 +109,8 @@ php_apache_sapi_header_handler(sapi_header_struct *sapi_header,sapi_headers_stru
                        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 {