[Jifty-commit] r576 - jifty/trunk/lib/Jifty

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sun Feb 12 20:23:59 EST 2006


Author: jesse
Date: Sun Feb 12 20:23:58 2006
New Revision: 576

Modified:
   /   (props changed)
   jifty/trunk/lib/Jifty/Handler.pm
   jifty/trunk/lib/Jifty/Response.pm
   jifty/trunk/lib/Jifty/Script/FastCGI.pm
   jifty/trunk/lib/Jifty/Server.pm

Log:
 r23615 at truegrounds:  jesse | 2006-02-12 20:23:11 -0500
 
 * Moved the wrapping of CGI->new() to something that runs once per process
 * Stop using Hook::LexWrap for sending HTTP headers.
 * In lay-speak: paint on some really bitchin 'go faster' stripes.
 


Modified: jifty/trunk/lib/Jifty/Handler.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Handler.pm	(original)
+++ jifty/trunk/lib/Jifty/Handler.pm	Sun Feb 12 20:23:58 2006
@@ -25,6 +25,7 @@
 =cut
 
 use base qw/Class::Accessor/;
+use Hook::LexWrap;
 __PACKAGE__->mk_accessors(qw(mason dispatcher cgi apache));
 
 =head2 new
@@ -39,6 +40,13 @@
     bless $self, $class;
 
     $self->create_cache_directories();
+    # Creating a new CGI object breaks FastCGI in all sorts of painful
+    # ways.  So wrap the call and preempt it if we already have one
+    use CGI;
+    wrap 'CGI::new', pre => sub {
+        $_[-1] = Jifty->handler->cgi if Jifty->handler->cgi;
+    };
+
 
     return $self;
 }
@@ -134,13 +142,6 @@
     $self->cgi($args{cgi});
     $self->apache(HTML::Mason::FakeApache->new(cgi => $self->cgi));
 
-    # Creating a new CGI object breaks FastCGI in all sorts of painful
-    # ways.  So wrap the call and preempt it if we already have one
-    use Hook::LexWrap;
-    wrap 'CGI::new', pre => sub {
-        $_[-1] = Jifty->handler->cgi if Jifty->handler->cgi;
-    };
-
     local $HTML::Mason::Commands::JiftyWeb = Jifty::Web->new();
     Jifty->web->request(Jifty::Request->new()->fill($self->cgi));
 

Modified: jifty/trunk/lib/Jifty/Response.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Response.pm	(original)
+++ jifty/trunk/lib/Jifty/Response.pm	Sun Feb 12 20:23:58 2006
@@ -30,6 +30,11 @@
 
 sub add_header {
     my $self = shift;
+    # This one is so we can get jifty's headers into mason
+    # Otherwise we'd have to wrap mason's output layer
+     Jifty->handler->apache->header_out( @_ );
+
+
     push @{$self->{headers}}, [@_];
 }
 

Modified: jifty/trunk/lib/Jifty/Script/FastCGI.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Script/FastCGI.pm	(original)
+++ jifty/trunk/lib/Jifty/Script/FastCGI.pm	Sun Feb 12 20:23:58 2006
@@ -56,12 +56,6 @@
 sub run {
     Jifty->new();
 
-    use Hook::LexWrap;
-    wrap 'HTML::Mason::FakeApache::send_http_header', pre => sub {
-        my $r = shift;
-        $r->header_out( @{$_} ) for Jifty->web->response->headers;
-    };
-
     while ( my $cgi = CGI::Fast->new ) {
         # the whole point of fastcgi requires the env to get reset here..
         # So we must squash it again

Modified: jifty/trunk/lib/Jifty/Server.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Server.pm	(original)
+++ jifty/trunk/lib/Jifty/Server.pm	Sun Feb 12 20:23:58 2006
@@ -49,7 +49,6 @@
         my $r = shift;
         my $status = $r->header_out('Status') || '200 Jifty OK';
         print STDOUT "HTTP/1.0 $status\n";
-        $r->header_out( @{$_} ) for Jifty->web->response->headers;
     };
 
     return ($self);


More information about the Jifty-commit mailing list