]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #27196 (Missing content_length initialization in apache 2
authorIlia Alshanetsky <iliaa@php.net>
Mon, 9 Feb 2004 23:28:48 +0000 (23:28 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 9 Feb 2004 23:28:48 +0000 (23:28 +0000)
sapis).

NEWS
sapi/apache2filter/sapi_apache2.c
sapi/apache2handler/sapi_apache2.c

diff --git a/NEWS b/NEWS
index 0cf45290f0230c5fd3d77bd838a6f28ff00568f1..b22fb40e527b19483857addd2bfd1e0a5c298d5e 100644 (file)
--- 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)
index 3b1212a3fca5024e9c292c8b9f04b8b68d09813a..46d446bf88313c6e986570b94974dec82102a58f 100644 (file)
@@ -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");
index f9bd38a1080591e0895a64ee770272b4b3600398..fd5a117819fc0107cfd4bea30ca7bc3b4bb56f0b 100644 (file)
@@ -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");