On 3/26/07, Torsten Foertsch <[EMAIL PROTECTED]> wrote:
Not entirely true, a CGI script (mod_cgid?) can generate an internal redirect
saying

Status: 200
Location: /path/to/other.html

Both mod_cgi and mod_cgid contain this code:

        if (location && location[0] == '/' && r->status == 200) {
            /* This redirect needs to be a GET no matter what the original
             * method was.
             */
            r->method = apr_pstrdup(r->pool, "GET");
            r->method_number = M_GET;

            /* We already read the message body (if any), so don't allow
             * the redirected request to think it has one.  We can ignore
             * Transfer-Encoding, since we used REQUEST_CHUNKED_ERROR.
             */
            apr_table_unset(r->headers_in, "Content-Length");

            ap_internal_redirect_handler(location, r);
            return OK;
        }

Interesting.  Now that I look at what Anthony wanted to do though, it
doesn't seem very useful for his case, since he wants to collect the
output.  In fact, an internal_redirect in general is not right for
that.  You need a subrequest instead.

As for Modperl::Registry, you need to use the perl-script handler and enable
PerlOptions +ParseHeaders. Then the same approach works also for Registry
scripts, see modperl_cgi.c:modperl_cgi_header_parse().

In ModPerl::Registry, you don't need to resort to tricks like that.
You get passed an Apache2::RequestRec object to do whatever you like
with.

- Perrin

Reply via email to