httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@covalent.net
Subject Re: cvs commit: apache-2.0/src/modules/standard mod_include.c
Date Fri, 22 Sep 2000 15:21:18 GMT

This won't work.  What we have just done here, unless I am missing
something BIG, is to set r->output_filters to the next filter in the
chain.  The problem is that when we get all the back up to the handler, it
will call ap_pass_brigade with r->output_filters, and it will bypass all
of the filters before the mod_include filter.

This patch needs to be backed out.  What we really want, IMHO, is a change
to the sub_request API to inform the sub_request of where it's filter
stack should begin.  Maybe, we need a new pointer in the request_rec,
something like:  r->sub_filter_start, which is set just before creating a
sub_request?

Ryan

On 22 Sep 2000 trawick@locus.apache.org wrote:

> trawick     00/09/22 07:57:14
> 
>   Modified:    src/modules/standard mod_include.c
>   Log:
>   mod_include now tweaks the subrequest output filter chain so that
>   only *subsequent* filters from the original request are inherited.
>   Previously, *all* filters from the original request were inherited.
>   
>   Currently, any filter which runs a subrequest should do the same
>   thing (though a cleaner interface may be appropriate.)
>   
>   With this change, subrequests are properly filtered much more often.
>   
>   Revision  Changes    Path
>   1.64      +15 -6     apache-2.0/src/modules/standard/mod_include.c
>   
>   Index: mod_include.c
>   ===================================================================
>   RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_include.c,v
>   retrieving revision 1.63
>   retrieving revision 1.64
>   diff -u -r1.63 -r1.64
>   --- mod_include.c	2000/09/21 16:32:48	1.63
>   +++ mod_include.c	2000/09/22 14:57:08	1.64
>   @@ -622,7 +622,7 @@
>    
>    /* --------------------------- Action handlers ---------------------------- */
>    
>   -static int include_cgi(char *s, request_rec *r)
>   +static int include_cgi(char *s, request_rec *r, ap_filter_t *next)
>    {
>        request_rec *rr = ap_sub_req_lookup_uri(s, r);
>        int rr_status;
>   @@ -651,6 +651,9 @@
>    
>        rr->content_type = CGI_MAGIC_TYPE;
>    
>   +    /* The subrequest should inherit the remaining filters from this request. */
>   +    rr->output_filters = next;
>   +
>        /* Run it. */
>    
>        rr_status = ap_run_sub_req(rr);
>   @@ -694,7 +697,8 @@
>        return 1;
>    }
>    
>   -static int handle_include(ap_bucket *in, request_rec *r, const char *error, int noexec)
>   +static int handle_include(ap_bucket *in, request_rec *r, ap_filter_t *next,
>   +                          const char *error, int noexec)
>    {
>        char tag[MAX_STRING_LEN];
>        char parsed_string[MAX_STRING_LEN];
>   @@ -779,8 +783,13 @@
>    	    if (rr) 
>    		ap_set_module_config(rr->request_config, &includes_module, r);
>    
>   -            if (!error_fmt && ap_run_sub_req(rr)) {
>   -                error_fmt = "unable to include \"%s\" in parsed file %s";
>   +            if (!error_fmt) {
>   +                /* The subrequest should inherit the remaining filters from 
>   +                 * this request. */
>   +                rr->output_filters = next;
>   +                if (ap_run_sub_req(rr)) {
>   +                    error_fmt = "unable to include \"%s\" in parsed file %s";
>   +                }
>                }
>                ap_chdir_file(r->filename);
>                if (error_fmt) {
>   @@ -982,7 +991,7 @@
>            }
>            else if (!strcmp(tag, "cgi")) {
>                parse_string(r, tag_val, parsed_string, sizeof(parsed_string), 0);
>   -            if (include_cgi(parsed_string, r) == -1) {
>   +            if (include_cgi(parsed_string, r, next) == -1) {
>                    ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
>                                "invalid CGI ref \"%s\" in %s", tag_val, file);
>                    ap_rputs(error, r);
>   @@ -2374,7 +2383,7 @@
>                    ret = handle_set(tagbuck, r, error);
>                }
>                else if (!strcmp(directive, "include")) {
>   -                ret = handle_include(tagbuck, r, error, noexec);
>   +                ret = handle_include(tagbuck, r, f->next, error, noexec);
>                }
>                else if (!strcmp(directive, "echo")) {
>                    ret = handle_echo(tagbuck, r, error);
>   
>   
>   
> 


_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------



Mime
View raw message