On Fri, 2 Jun 2000, Geoffrey Young wrote:

> hi all...
> 
> this simple script:
> 
> #!/usr/bin/perl
> 
> my $r = shift;
> $r->err_headers_out->add('Set-Cookie' => "name=error");
> warn "pre headers_out: " . $r->headers_out->get('Set-Cookie');
> 
> $r->send_http_header('text/plain');
> 
> warn "post headers_out: " . $r->headers_out->get('Set-Cookie');
> print "done";
> 
> yields:
> pre headers_out:  at /usr/local/apache/perl-bin/err.cgi line 7.
> post headers_out: name=error at /usr/local/apache/perl-bin/err.cgi line 9.
> 
> and sets the cookie...
> 
> I was initially trying to create a PerlInitHandler to put a cookie in
> err_headers_out, which I would expect to be set only if other handlers down
> the line error out, but it was being set every request.
> 
> am I misunderstanding err_headers_out, or is send_http_header misbehaving? 

see http_protocol.c:send_http_header():

    if (!ap_is_empty_table(r->err_headers_out))
        r->headers_out = ap_overlay_tables(r->pool, r->err_headers_out,
                                        r->headers_out);

Reply via email to