Return-Path: Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: (qmail 95504 invoked from network); 17 Feb 2007 03:26:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Feb 2007 03:26:55 -0000 Received: (qmail 21866 invoked by uid 500); 17 Feb 2007 03:26:57 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 21850 invoked by uid 500); 17 Feb 2007 03:26:56 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Delivered-To: moderator for modperl@perl.apache.org Received: (qmail 8033 invoked by uid 99); 15 Feb 2007 15:03:53 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) X-Authentication-Warning: night.yars.free.net: lav set sender to lav@netis.ru using -f Date: Thu, 15 Feb 2007 18:01:33 +0300 From: "Alexander V. Lukyanov" To: modperl@perl.apache.org Subject: a bug with redirect in mod_perl-2.0.3 and CGI-3.25 Message-ID: <20070215150133.GA17421@night.netis.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.11 X-NETIS-MailScanner-Information: Please contact NETIS Telecom for more information (+7 0852 797709) X-NETIS-MailScanner: Found to be clean X-NETIS-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-1, required 6, autolearn=disabled, ALL_TRUSTED -1.00) X-NETIS-MailScanner-From: lav@netis.ru X-NETIS-MailScanner-To: modperl@perl.apache.org X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No 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.