You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jeff Trawick <tr...@attglobal.net> on 2002/03/15 22:30:36 UTC

[PATCH] PRs 8902, 8907, 9983: get nph scripts working

Axing unnecessary/harmful filters gets nph scripts working again.  

If someone ever wants nph function beyond what 1.3 provides then of
course it gets more complicated and NPH probably turns into "we can't
avoid parsing it but we'll still trust you".  (examples: filtering
content, byterange requests, letting script on EBCDIC box output
headers in EBCDIC).  I doubt that it is worth the effort.

My first patch shown at the bottom, but that left the byterange filter
in the chain, and that is just going to make a mess of things.

Index: modules/generators/mod_cgid.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgid.c,v
retrieving revision 1.116
diff -u -r1.116 mod_cgid.c
--- modules/generators/mod_cgid.c	14 Mar 2002 22:19:13 -0000	1.116
+++ modules/generators/mod_cgid.c	15 Mar 2002 21:29:17 -0000
@@ -1148,11 +1148,24 @@
     } 
 
     if (nph) {
+        struct ap_filter_t *cur;
+        
         /* Passing our socket down the filter chain in a pipe bucket
          * gives up the responsibility of closing the socket, so
          * get rid of the cleanup.
          */
         apr_pool_cleanup_kill(r->pool, (void *)sd, close_unix_socket);
+
+        /* get rid of all filters up through protocol...  since we
+         * haven't parsed off the headers, there is no way they can
+         * work
+         */
+
+        cur = r->proto_output_filters;
+        while (cur && cur->frec->ftype < AP_FTYPE_CONNECTION) {
+            cur = cur->next;
+        }
+        r->output_filters = r->proto_output_filters = cur;
 
         bb = apr_brigade_create(r->pool);
         b = apr_bucket_pipe_create(tempsock);

(imagine the same change to mod_cgi.c)

Comments?  Thoughts on a better way to do it without boiling the
ocean?

-------first patch-----------

Index: modules/generators/mod_cgi.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgi.c,v
retrieving revision 1.120
diff -u -r1.120 mod_cgi.c
--- modules/generators/mod_cgi.c	14 Mar 2002 22:19:13 -0000	1.120
+++ modules/generators/mod_cgi.c	15 Mar 2002 20:58:55 -0000
@@ -733,6 +733,7 @@
     }
 
     if (script_in && nph) {
+        r->assbackwards = 1;    /* tell core not to generate headers */
         bb = apr_brigade_create(r->pool);
 	b = apr_bucket_pipe_create(script_in);
 	APR_BRIGADE_INSERT_TAIL(bb, b);
Index: modules/generators/mod_cgid.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgid.c,v
retrieving revision 1.116
diff -u -r1.116 mod_cgid.c
--- modules/generators/mod_cgid.c	14 Mar 2002 22:19:13 -0000	1.116
+++ modules/generators/mod_cgid.c	15 Mar 2002 20:58:55 -0000
@@ -1154,6 +1154,7 @@
          */
         apr_pool_cleanup_kill(r->pool, (void *)sd, close_unix_socket);
 
+        r->assbackwards = 1;    /* tell core not to generate headers */
         bb = apr_brigade_create(r->pool);
         b = apr_bucket_pipe_create(tempsock);
         APR_BRIGADE_INSERT_TAIL(bb, b);


-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...