You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Justin Erenkrantz <je...@apache.org> on 2002/05/06 01:14:54 UTC

[PATCH] Don't use C-L filter if content-length is set

This is the patch that was hinted at earlier from the
mod_proxy/content-length thread.  This will remove the content-length
filter if it is called with a content-length already set.

I won't plan on committing this since Ryan has reservations about
this.  If someone can prove that this makes the server faster,
I'd be game to seeing if we can get this in.  I think it might
help especially for HTTP/1.0 clients with a C-L set.  -- justin

Index: server/protocol.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/protocol.c,v
retrieving revision 1.97
diff -u -r1.97 protocol.c
--- server/protocol.c	28 Apr 2002 06:24:53 -0000	1.97
+++ server/protocol.c	5 May 2002 23:09:17 -0000
@@ -1131,6 +1131,13 @@
 
     ctx = f->ctx;
     if (!ctx) { /* first time through */
+        /* If the content-length is already set, then this request
+         * doesn't need our help.  Get out of the way.
+         */
+        if (apr_table_get(r->headers_out, "Content-Length")) {
+            ap_remove_output_filter(f);
+            return ap_pass_brigade(f->next, b);
+        }
         f->ctx = ctx = apr_pcalloc(r->pool, sizeof(struct content_length_ctx));
         ctx->compute_len = 1;   /* Assume we will compute the length */
     }