Hello! I have a perl script which uses CGI package and does redirect(). It is run under mod_perl. For some reason I get HTTP status "200 OK", but the header "Location:" is set and the response body says the document has moved.
I have debugged it somewhat, found that send_cgi_header is correctly called by CGI's redirect, the function send_cgi_header sets r->status to 302 and r->status_line to "302 Moved" correctly. But then the status is reset to 200 in RegistryCooker::default_handler. Then Apache's validate_status_line function finds mismatch between status and status_line and resets the status_line to "200 OK" too. I beleave there is a bug somewhere which prevents redirecting from CGI when using mod_perl. I fixed it by this patch, but I'm not sure it is "the right way" (TM): --- RegistryCooker.pm.1 Thu Feb 15 17:57:00 2007 +++ RegistryCooker.pm Thu Feb 15 17:40:59 2007 @@ -168,7 +168,7 @@ # status after running it my $old_status = $self->{REQ}->status; my $rc = $self->run; - my $new_status = $self->{REQ}->status($old_status); + my $new_status = $self->{REQ}->status; #($old_status); return ($rc == Apache2::Const::OK && $old_status != $new_status) ? $new_status : $rc; -- Alexander.