RE: err_headers_out Q
-Original Message- From: Doug MacEachern [mailto:[EMAIL PROTECTED]] Sent: Friday, June 09, 2000 1:21 PM To: Geoffrey Young Cc: '[EMAIL PROTECTED]' Subject: Re: err_headers_out Q 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); oh, that explains it. and thanks for pointing out the relevant code bits... sorry it took me so long to express my graditude :) --Geoff
Re: err_headers_out Q
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);
Re: err_headers_out Q
Doug MacEachern wrote: 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); Basically, what the code above says is that when calling send_http_header(), if the headers_out table is not empty, add them to the outgoing headers. Am I correct? If so, what is the rational behind this? I thought that err_headers_out were only sent if an error occured. I would have made the same assumption as Geoff. -- Drew Taylor Vialogix Communications, Inc. 501 N. College Street Charlotte, NC 28202 704 370 0550 http://www.vialogix.com/
Re: err_headers_out Q
On Fri, 9 Jun 2000, Drew Taylor wrote: Doug MacEachern wrote: 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); Basically, what the code above says is that when calling send_http_header(), if the headers_out table is not empty, add them to the outgoing headers. Am I correct? If so, what is the rational behind this? I thought that err_headers_out were only sent if an error occured. I would have made the same assumption as Geoff. yeah, it's explained in httpd.h: * The difference between headers_out and err_headers_out is that the * latter are printed even on error, and persist across internal redirects * (so the headers printed for ErrorDocument handlers will have them). *
Re: err_headers_out Q
Doug MacEachern wrote: yeah, it's explained in httpd.h: * The difference between headers_out and err_headers_out is that the * latter are printed even on error, and persist across internal redirects * (so the headers printed for ErrorDocument handlers will have them). Oh... that makes sense. So if you want a header printed no matter what, add it to err_headers_out. I'll have to remember that. Thanks for the clarification! -- Drew Taylor Vialogix Communications, Inc. 501 N. College Street Charlotte, NC 28202 704 370 0550 http://www.vialogix.com/
err_headers_out Q
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? --Geoff