From: Ilia Alshanetsky Date: Mon, 9 Feb 2004 23:28:48 +0000 (+0000) Subject: MFH: Fixed bug #27196 (Missing content_length initialization in apache 2 X-Git-Tag: php-4.3.5RC3~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=125d5a2b738a9cd0b525f4d75cbfd32fd3496149;p=php MFH: Fixed bug #27196 (Missing content_length initialization in apache 2 sapis). --- diff --git a/NEWS b/NEWS index 0cf45290f0..b22fb40e52 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ PHP 4 NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? Feb 2004, Version 4.3.5 +- Fixed bug #27196 (Missing content_length initialization in apache 2 sapis). + (Ilia, pdoru at kappa dot ro) - Fixed bug #27175 (tzset() is not being called by PHP on startup). (Ilia, sagawa at sohgoh dot net) - Fixed bug #27172 (Possible floating point exception in gmp_powm()). (Ilia) diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c index 3b1212a3fc..46d446bf88 100644 --- a/sapi/apache2filter/sapi_apache2.c +++ b/sapi/apache2filter/sapi_apache2.c @@ -376,6 +376,7 @@ static int php_input_filter(ap_filter_t *f, apr_bucket_brigade *bb, static void php_apache_request_ctor(ap_filter_t *f, php_struct *ctx TSRMLS_DC) { char *content_type; + char *content_length; const char *auth; PG(during_request_startup) = 0; @@ -393,6 +394,10 @@ static void php_apache_request_ctor(ap_filter_t *f, php_struct *ctx TSRMLS_DC) SG(request_info).post_data = ctx->post_data; SG(request_info).post_data_length = ctx->post_len; efree(content_type); + + content_length = (char *) apr_table_get(f->r->headers_in, "Content-Length"); + SG(request_info).content_length = (content_length ? atoi(content_length) : 0); + apr_table_unset(f->r->headers_out, "Content-Length"); apr_table_unset(f->r->headers_out, "Last-Modified"); apr_table_unset(f->r->headers_out, "Expires"); diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index f9bd38a108..fd5a117819 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -414,6 +414,7 @@ static apr_status_t php_server_context_cleanup(void *data_) static void php_apache_request_ctor(request_rec *r, php_struct *ctx TSRMLS_DC) { char *content_type; + char *content_length; const char *auth; SG(sapi_headers).http_response_code = !r->status ? HTTP_OK : r->status; @@ -428,6 +429,9 @@ static void php_apache_request_ctor(request_rec *r, php_struct *ctx TSRMLS_DC) ap_set_content_type(r, apr_pstrdup(r->pool, content_type)); efree(content_type); + content_length = (char *) apr_table_get(f->r->headers_in, "Content-Length"); + SG(request_info).content_length = (content_length ? atoi(content_length) : 0); + apr_table_unset(r->headers_out, "Content-Length"); apr_table_unset(r->headers_out, "Last-Modified"); apr_table_unset(r->headers_out, "Expires");