X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=41b54ebe285dc5de68760f902c3ce94b366e436c;hp=6f1848a4db3502333a02f5e0e66faea5cf8f423e;hb=878b821cd4548d9d3f5a6c5aa05fb2f0c29fe3b0;hpb=048f45ee23401c9f2fbe241639f2687c1e79f990 diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 6f1848a..41b54eb 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -1590,8 +1590,14 @@ sub prepare { $c->prepare_cookies; $c->prepare_path; - # On-demand parsing - $c->prepare_body unless $c->config->{parse_on_demand}; + # Prepare the body for reading, either by prepare_body + # or the user, if they are using $c->read + $c->prepare_read; + + # Parse the body unless the user wants it on-demand + unless ( $c->config->{parse_on_demand} ) { + $c->prepare_body; + } } my $method = $c->req->method || ''; @@ -1806,6 +1812,10 @@ C<$maxlength> defaults to the size of the request if not specified. You have to set C<< MyApp->config->{parse_on_demand} >> to use this directly. +Warning: If you use read(), Catalyst will not process the body, +so you will not be able to access POST parameters or file uploads via +$c->request. You must handle all body parsing yourself. + =cut sub read { my $c = shift; return $c->engine->read( $c, @_ ) } @@ -2217,8 +2227,8 @@ This causes C to map to C. =head1 ON-DEMAND PARSER The request body is usually parsed at the beginning of a request, -but if you want to handle input yourself or speed things up a bit, -you can enable on-demand parsing with a config parameter. +but if you want to handle input yourself, you can enable on-demand +parsing with a config parameter. MyApp->config->{parse_on_demand} = 1;