You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Marc Slemko <ma...@znep.com> on 1997/09/28 20:38:38 UTC

[BUG] include virtual and SCRIPT_NAME w/path_info

If I do an include virtual of /cgi-bin/printenv/full/path in a document, I
get:

SCRIPT_NAME=/cgi-bin/printenv/full/path

That should be:

SCRIPT_NAME=/cgi-bin/printenv

It is not because util_script.c has: 

    /* Note that the code below special-cases scripts run from includes,
     * because it "knows" that the sub_request has been hacked to have the
     * args and path_info of the original request, and not any that may have
     * come with the script URI in the include command.  Ugh.
     */

    if (!strcmp (r->protocol, "INCLUDED")) {
        table_set (e, "SCRIPT_NAME", r->uri);
        if (r->path_info && *r->path_info)
            table_set (e, "PATH_INFO", r->path_info);
    } else if (!r->path_info || !*r->path_info) {
        table_set (e, "SCRIPT_NAME", r->uri);
    } else {
        int path_info_start = find_path_info (r->uri, r->path_info);

        table_set (e, "SCRIPT_NAME", pstrndup(r->pool, r->uri,
                                              path_info_start));

        table_set (e, "PATH_INFO", r->path_info);
    }

What is it talking about?  I can't see how the comment applies to include
virtual.  I can see mod_include setting that for include CGI, but I don't
fully understand why.  

Grr.  I see.  The reason is because the semantics of exec cgi are a broken
pile of crap.  So what we want is a way to do the above for exec cgi only
and not include virtual.  We could change r->protocol to be different for
the two cases, but that is bad.  Ideas?