I'm writing my first module using modperl, so I'm probably doing
something really wrong, but I haven't been able to figure this out. I
want my script to return an HTTP error code to the client, and I want
that error code to be logged to the httpd access log. If I use this
script:
my $r = Apache->request;
$r->status(304);
everything works as expected: the client receives a "304 Not Modified"
status line, and the log shows a "304" status.
But if I do this:
$r->status(304);
$r->err_header_out("X-Test-Header" => "abc");
$r->send_http_header();
then the client still receives the 304 status as expected, as well as
the extra header, but the log shows a status of 200, not 304. In fact,
the err_header_out doesn't matter; if I just call send_http_header, the
log shows 200. How can I make the log show the correct status?
Another problem is that in some cases, such as if I return a "400 Bad
Request" status, I'm getting a "Connection: close" header as well. Is
there any way I can control this? I don't want to send a Connection:
close header, even if I return an error status.
Thanks for any help,
--Mark