perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Young <>
Subject Apache::RegistryNG fix
Date Wed, 30 Jan 2002 14:34:21 GMT
hi guys...

sorry for keeping down the 1.3 path - I'll get with the program

I was playing around with Apache::RegistryNG and found what seems to
be a bug.

Apache::Registry and Apache::RegistryNG do not behave the same wrt

with Apache::RegistryNG, the simple redirect script:

print "Location:";


<TITLE>302 Moved</TITLE>
The document has moved <A
<P>Additionally, a 302 Found
error was encountered while trying to use an ErrorDocument to handle
the request.
<ADDRESS>Apache/1.3.24-dev Server at Port

basically, it looks like Apache is entering into its recursive
ErrorDocument cycle.

after a bit of research, I came up with the below patch.  it basically
mimics what Apache::Registry does wrt $r->status: true handlers aren't
supposed to set $r->status themselves, but instead return the proper
HTTP code to indicate what they want to do.  what was happening was
that $r->status was being set to 302 in PerlRun and handler() was
returning 302 as well, so Apache thinks the error is recursive.  at
least that's my theory.

so, with this patch, Apache::RegistryNG traps the old status code and
restores it after the handler is run, which is the same thing that
Apache::Registry does.


Index: lib/Apache/
RCS file: /home/cvspublic/modperl/lib/Apache/,v
retrieving revision 1.7
diff -u -r1.7
--- lib/Apache/    28 Sep 2000 19:59:39 -0000      1.7
+++ lib/Apache/    30 Jan 2002 14:26:46 -0000
@@ -48,9 +48,15 @@
+    my $old_status = $r->status;
     $rc = $pr->run(@_);
-    return ($rc != OK) ? $rc : $pr->status;
+    my $pr_status = $pr->status;
+    $r->status($old_status);
+    return ($rc != OK) ? $rc : $pr_status;

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message