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

index 570d01232887b30dbdf76315189713fb447da9af..22df068626d52016dc2c05ec323d3be9ce8b0533 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;
@@ -394,6 +395,10 @@ static void php_apache_request_ctor(ap_filter_t *f, php_struct *ctx TSRMLS_DC)
        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 e00687f9cb37fc9c8fb563c433e8e3f0186eb9b0..e6faeb20b50fb912a2b7c28bbd9df2e25b2ee308 100644 (file)
@@ -409,6 +409,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;
@@ -423,6 +424,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");