From: Rasmus Lerdorf Date: Fri, 5 Feb 2010 18:59:05 +0000 (+0000) Subject: Fix bug #50940 X-Git-Tag: php-5.2.13RC2~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6652657f12f0fdbd017b6a0d1a6789dad69ab55d;p=php Fix bug #50940 --- diff --git a/NEWS b/NEWS index c9d9f385c2..428bf72025 100644 --- 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 diff --git a/sapi/apache/mod_php5.c b/sapi/apache/mod_php5.c index 3c61678dca..cf458456c6 100644 --- a/sapi/apache/mod_php5.c +++ b/sapi/apache/mod_php5.c @@ -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) { diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c index b8f3e89dc8..ec89f404d1 100644 --- a/sapi/apache2filter/sapi_apache2.c +++ b/sapi/apache2filter/sapi_apache2.c @@ -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 diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index bd977c76ca..0829c2619e 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -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 {