hey, guys

just for the record....I finally got this thing to work. However, it does
have some bizarre behavior. After compiling  the patch,
$subr->run(1) returns headers without calling the send_http_header method.
This holds true for static files and for cgis that only set the content type
header. For cgis that add any additional header like Location, the headers
are not returned unless you explicitly call send_http_header. I know that
our cgi's at most only alter the Location header in addition to content
type...so...I coded around this with the following:

        my $subr = $r->lookup_uri($uri);
        if($r->dir_config('is_cgi')) {
            $subr->handler('cgi-script');
        } else {
            $subr->handler('server-parsed');
        }
        $subr->run(1);
        if($subr->header_out('Location')) {
           $subr->send_http_header;
        } else {
           $r->print(&create_img_tag($file,$SCRIPT_ON,$status));
        }
        my $status = $subr->status;
        return $status;

if I always called send_http_header, a second set of HTTP headers would be
appended to static documents and to cgis that only change the content type
header.

Just an FYI...
-amen

Doug MacEachern wrote:

> On Mon, 21 Aug 2000, Alex Menendez wrote:
>
> >
> > ok, what about cgi's that generate Location: headers. Am I out of luck
> > here? should I contemplate changing src for ap_run_sub_req
>
> doh, right, headers are not added until run().  no need to change
> ap_run_sub_req, we can support this.  with the patch below you can say
> $subr->run(1), where 1 enables send_http_header() within subrequests.
>
> --- src/modules/perl/Apache.xs  2000/08/15 19:36:32     1.103
> +++ src/modules/perl/Apache.xs  2000/08/21 19:38:32
> @@ -1996,10 +2003,15 @@
>             "Apache::SubRequest::DESTROY(0x%lx)\n", (unsigned long)r));
>
>  int
> -run(r)
> +run(r, allow_send_header=0)
>      Apache::SubRequest r
> +    int allow_send_header
>
>      CODE:
> +    if (allow_send_header) {
> +        r->assbackwards = 0;
> +    }
> +
>      RETVAL = run_sub_req(r);
>
>      OUTPUT:

Reply via email to