Do moar, moving headers and cookies. This breaks engine::psgi, fix later..
[catagits/Catalyst-Runtime.git] / lib / Catalyst.pm
index f69afe0..ce007cd 100644 (file)
@@ -46,7 +46,16 @@ has state => (is => 'rw', default => 0);
 has stats => (is => 'rw');
 has action => (is => 'rw');
 has counter => (is => 'rw', default => sub { {} });
-has request => (is => 'rw', default => sub { $_[0]->request_class->new({}) }, required => 1, lazy => 1);
+has request => (
+    is => 'rw',
+    default => sub {
+        my $self = shift;
+        my %p;
+        $p{_uploadtmp} = $self->_uploadtmp if $self->_has_uploadtmp;
+        $self->request_class->new(\%p);
+    },
+    lazy => 1,
+);
 has response => (is => 'rw', default => sub { $_[0]->response_class->new({}) }, required => 1, lazy => 1);
 has namespace => (is => 'rw');
 
@@ -84,7 +93,7 @@ __PACKAGE__->stats_class('Catalyst::Stats');
 
 # Remember to update this in Catalyst::Runtime as well!
 
-our $VERSION = '5.90005';
+our $VERSION = '5.90006';
 
 sub import {
     my ( $class, @arguments ) = @_;
@@ -1576,7 +1585,7 @@ EOF
 =head2 run_options
 
 Contains a hash of options passed from the application script, including
-the original ARGV the script receieved, the processed values from that
+the original ARGV the script received, the processed values from that
 ARGV and any extra arguments to the script which were not processed.
 
 This can be used to add custom options to your application's scripts
@@ -1983,6 +1992,11 @@ etc.).
 
 =cut
 
+has _uploadtmp => (
+    is => 'ro',
+    predicate => '_has_uploadtmp',
+);
+
 sub prepare {
     my ( $class, @arguments ) = @_;
 
@@ -1991,7 +2005,8 @@ sub prepare {
     # into the application.
     $class->context_class( ref $class || $class ) unless $class->context_class;
 
-    my $c = $class->context_class->new({});
+    my $uploadtmp = $class->config->{uploadtmp};
+    my $c = $class->context_class->new({ $uploadtmp ? (_uploadtmp => $uploadtmp) : ()});
 
     # For on-demand data
     $c->request->_context($c);
@@ -2012,8 +2027,6 @@ sub prepare {
             $c->prepare_request(@arguments);
             $c->prepare_connection;
             $c->prepare_query_parameters;
-            $c->prepare_headers;
-            $c->prepare_cookies;
             $c->prepare_path;
 
             # Prepare the body for reading, either by prepare_body
@@ -2105,25 +2118,9 @@ Prepares connection.
 
 sub prepare_connection {
     my $c = shift;
-    $c->engine->prepare_connection( $c, @_ );
+    $c->request->prepare_connection;
 }
 
-=head2 $c->prepare_cookies
-
-Prepares cookies.
-
-=cut
-
-sub prepare_cookies { my $c = shift; $c->engine->prepare_cookies( $c, @_ ) }
-
-=head2 $c->prepare_headers
-
-Prepares headers.
-
-=cut
-
-sub prepare_headers { my $c = shift; $c->engine->prepare_headers( $c, @_ ) }
-
 =head2 $c->prepare_parameters
 
 Prepares parameters.
@@ -2405,7 +2402,7 @@ $c->request.  You must handle all body parsing yourself.
 
 =cut
 
-sub read { my $c = shift; return $c->engine->read( $c, @_ ) }
+sub read { my $c = shift; return $c->request->read( @_ ) }
 
 =head2 $c->run
 
@@ -2652,7 +2649,7 @@ sub setup_engine {
 
         $meta->add_method(handler => sub {
             my $r = shift;
-            my $psgi_app = $class->psgi_app;
+            my $psgi_app = $class->_finalized_psgi_app;
             $apache->call_app($r, $psgi_app);
         });