Skip to content

Commit 1947334

Browse files
committed
Fix bug #50940
1 parent 3a239b1 commit 1947334

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ PHP NEWS
2323
links or invalid paths. (Pierre)
2424
- Fixed error output to stderr on Windows. (Pierre)
2525

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

sapi/apache/mod_php5.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ static int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_head
196196

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

sapi/apache2filter/sapi_apache2.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_header_op_e
127127

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

sapi/apache2handler/sapi_apache2.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_header_op_e
119119
efree(ctx->content_type);
120120
}
121121
ctx->content_type = estrdup(val);
122+
} else if (!strcasecmp(sapi_header->header, "content-length")) {
123+
ap_set_content_length(ctx->r, strtol(val, (char **)NULL, 10));
122124
} else if (op == SAPI_HEADER_REPLACE) {
123125
apr_table_set(ctx->r->headers_out, sapi_header->header, val);
124126
} else {

0 commit comments

Comments
 (0)