I'm in the process of migrating from Apache 1.3 to Apache 2 and 
things were going swimmingly until I noticed that abort and redirect 
weren't working properly. Namely, that the status being returned was 
200 and therefore the redirect didn't redirect but instead displays 
the page saying that the document has moved and the abort just 
reports that the document has not been found tagged on to the end of 
any previous output (which is not flsuhed).

So, I have stripped down to a basic vanilla setup to ensure that the 
funkiness is not in my code elsewhere, using the following config 
(Fedora 4, Apache/2.0.54)

>>>
<VirtualHost 87.106.19.189:80>
ServerName mason.test
DocumentRoot /var/www/vhosts/mason.test/htdocs

PerlSetVar MasonArgsMethod mod_perl
PerlOptions +GlobalRequest
PerlModule HTML::Mason::ApacheHandler

PerlAddVar MasonDataDir /var/www/vhosts/mason.test/masondata

<Location />
SetHandler modperl
PerlHandler  HTML::Mason::ApacheHandler
</Location>
</VirtualHost>
<<<

This makes no difference. Instead I have to do the oldskool

$m->clear_buffer; # previous output not being flushed
$r->status(404); # Apache sets status to 200 otherwise
$m->abort(404);

or

$r->status(302);
$m->redirect('posh');
# no clear_buffer required since redirect calls clear_and_buffer


Alternatively I could patch HTML::Mason::Request::abort

>>>
sub abort
  {
      my ($self, $aborted_value) = @_;
+    $self->clear_buffer;
+    $self->apache_req->status($aborted_value);
      HTML::Mason::Exception::Abort->throw( error => 'Request->abort 
was called', aborted_value => $aborted_value );
  }
<<<<

but that seems really wrong, since it now clears the buffer for all 
aborts (that's fine for me, but it obviously flies in the face of the 
existence of clear_and_abort).

Anyhow, the nub of the problem is that for some reason or other, the 
status that is being passed back from the ApacheHandler 
handle_request method isn't being acted upon. (I have verified that 
handle-request is indeed returning the correct code)

Is this a known problem? Or should things work properly? (I'm 
guessing the latter since I thought Apache2 was officially supported 
these days)

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to