You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Noel Burton-Krahn <no...@burton-krahn.com> on 2002/01/12 01:05:33 UTC

mod_proxy/9456: r->hander="proxy-server" gets overwritten by "perl-script" in mod_mime

>Number:         9456
>Category:       mod_proxy
>Synopsis:       r->hander="proxy-server" gets overwritten by "perl-script" in mod_mime
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Fri Jan 11 16:10:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     noel@burton-krahn.com
>Release:        1.3.22
>Organization:
apache
>Environment:
    apache_1.3.22
    mod_perl-1.26
    mod_ssl-2.8.5-1.3.22
    redhat-7.1
    linux-2.4.3-12
>Description:
I'm using mod_rewrite to proxy requests to a remote server.  If I
proxy a request for /my_file.txt, everything works OK.  But, proxied
requests for /my_file.cgi fail.

Why?  I followed the request for /file.cgi after it went through
mod_rewrite.  After mod_rewrite was done, r->handler was
"proxy-server", the way it should be.  Then, came a call to
ap_find_types() in http_request.c:


    if (! (r->proxyreq != NOT_PROXY
           && r->parsed_uri.scheme != NULL
           && strcmp(r->parsed_uri.scheme, "http") == 0) ) {
        if ((access_status = ap_find_types(r)) != 0) {
            decl_die(access_status, "find types", r);
            return;
        }
    }

After the request went through mod_mime's find_ct(), r->handler was
set to "perl-script". Wrong!  I think that no module should be able to
change the handler if the request is proxied.

<my system>

    apache_1.3.22
    mod_perl-1.26
    mod_ssl-2.8.5-1.3.22
    redhat-7.1
    linux-2.4.3-12

<snippets from my http.conf>

    ProxyRequests On

    PerlPassEnv PERL5LIB
    PerlInitHandler Apache::StatINC
    <Files ~ "\.(pl|cgi)$">
      SetHandler perl-script
      PerlHandler Apache::Registry
      Options ExecCGI
    </Files>

    RewriteEngine On
    RewriteRule "^/redirect/(.*)" "http://proxy.com/$1" [P]
>How-To-Repeat:
Make a config with mod_rewrite proxying requets, and try to fetch anything.cgi
>Fix:
a) skip the call to ap_find_types in http_request.c if r->proxyreq != NOT_PROXY

b) fix mod_mime to ignore proxy requests
>Release-Note:
>Audit-Trail:
>Unformatted:
 [In order for any reply to be added to the PR database, you need]
 [to include <ap...@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]