[Jifty-commit] r566 - in jifty/trunk: lib/Jifty
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Thu Feb 9 20:09:15 EST 2006
Author: alexmv
Date: Thu Feb 9 20:09:15 2006
New Revision: 566
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Handler.pm
jifty/trunk/lib/Jifty/Web.pm
Log:
r9026 at zoq-fot-pik: chmrr | 2006-02-09 20:08:36 -0500
* Hate FastCGI. Specifically, it doesn't like there being other CGI
objects, or it wedges.
Modified: jifty/trunk/lib/Jifty/Handler.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Handler.pm (original)
+++ jifty/trunk/lib/Jifty/Handler.pm Thu Feb 9 20:09:15 2006
@@ -25,7 +25,7 @@
=cut
use base qw/Class::Accessor/;
-__PACKAGE__->mk_accessors(qw(mason dispatcher));
+__PACKAGE__->mk_accessors(qw(mason dispatcher cgi));
=head2 new
@@ -88,9 +88,10 @@
);
Module::Refresh->refresh;
+ $self->cgi($args{cgi});
local $HTML::Mason::Commands::JiftyWeb = Jifty::Web->new();
- Jifty->web->request(Jifty::Request->new()->fill($args{cgi}));
+ Jifty->web->request(Jifty::Request->new()->fill($self->cgi));
Jifty->log->debug("Recieved request for ".Jifty->web->request->path);
@@ -115,10 +116,12 @@
=cut
sub cleanup_request {
+ my $self = shift;
# Clean out the cache. the performance impact should be marginal.
# Consistency is improved, too.
Jifty->web->session->unload();
Jifty::Record->flush_cache;
+ $self->cgi(undef);
}
1;
Modified: jifty/trunk/lib/Jifty/Web.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web.pm (original)
+++ jifty/trunk/lib/Jifty/Web.pm Thu Feb 9 20:09:15 2006
@@ -612,12 +612,29 @@
# This is designed to work under CGI or FastCGI; will need an
# abstraction for mod_perl
+
+ # Clear out the mason output, if any
$self->mason->clear_buffer if $self->mason;
- my $apache = $self->mason ? $self->mason->fake_apache : HTML::Mason::FakeApache->new();
+ # Now, we need to get out hands on a HTML::Mason::FakeApache --
+ # but *carefully*. FakeApache wants a CGI object, and if it
+ # doesn't get one, it makes one for itself. The difficulty is
+ # that under FastCGI, if you ever create a second CGI object, it
+ # wedges all future requests with the state of that request.
+
+ # Hence, we use the FakeApache that HTTP::Mason::Request::Jifty
+ # held onto, or we make one by hand, passing it the cgi object
+ # that the handler is still holding onto
+ my $apache = $self->mason ?
+ $self->mason->fake_apache :
+ HTML::Mason::FakeApache->new( cgi => Jifty->handler->cgi );
+
+ # Headers..
$apache->header_out( Location => $page );
$apache->header_out( Status => 302 );
$apache->send_http_header();
+
+ # Abort or last_rule out of here
$self->mason->abort if $self->mason;
Jifty::Dispatcher::last_rule();
More information about the Jifty-commit
mailing list