I resend it. it seems that my mailer corrupted the attachement.
--
Best regards,
Doru Petrescu
Senior Software Engineer
Astral Telecom Bucuresti
--- Begin Message ---
Hi,
While playing with the upload progress meter I noticed that apache2
sapi implementation does not initialize the content-length sapi
variable. Apache 1.3 sapi does! and so does ALL OTHER interfaces. A
quick grep into the sources will reveal that only apache2handler and
apache2filter does not initialize this. Is there a reason for this ? Or
is just something that sliped ?
I wrote a patch to fix this. see attached. tested and it works with
no problem and correctly reports the content-length.
It is very simple and straight forward. copy/paste from apache 1.3
interface. now, I just wish nobody will upload anything over 2GB -
integer overflow will doom the upload.
--
Best regards,
Doru Petrescu
Senior Software Engineer
Astral Telecom Bucuresti
diff -rubB orig/php-4.3.4/sapi/apache2filter/sapi_apache2.c php-4.3.4/sapi/apache2filter/sapi_apache2.c
--- orig/php-4.3.4/sapi/apache2filter/sapi_apache2.c 2003-08-03 22:31:13.000000000 +0300
+++ php-4.3.4/sapi/apache2filter/sapi_apache2.c 2003-11-19 19:34:02.000000000 +0200
@@ -376,6 +376,7 @@
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 @@
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 -rubB orig/php-4.3.4/sapi/apache2handler/sapi_apache2.c php-4.3.4/sapi/apache2handler/sapi_apache2.c
--- orig/php-4.3.4/sapi/apache2handler/sapi_apache2.c 2003-10-02 06:24:43.000000000 +0300
+++ php-4.3.4/sapi/apache2handler/sapi_apache2.c 2003-11-19 19:34:52.000000000 +0200
@@ -414,6 +414,7 @@
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 @@
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");
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php