[Jifty-commit] r551 - in jifty/trunk: lib/Jifty lib/Jifty/Web
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Mon Feb 6 17:42:14 EST 2006
Author: alexmv
Date: Mon Feb 6 17:42:14 2006
New Revision: 551
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Handler.pm
jifty/trunk/lib/Jifty/MasonHandler.pm
jifty/trunk/lib/Jifty/Request.pm
jifty/trunk/lib/Jifty/Web/PageRegion.pm
Log:
r8956 at zoq-fot-pik: chmrr | 2006-02-06 17:41:35 -0500
* Fixes to only print HTTP header once
Modified: jifty/trunk/lib/Jifty/Handler.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Handler.pm (original)
+++ jifty/trunk/lib/Jifty/Handler.pm Mon Feb 6 17:42:14 2006
@@ -63,6 +63,7 @@
error_format => 'text',
default_escape_flags => 'h',
autoflush => 0,
+ request_class => 'Jifty::MasonRequest',
plugins => ['Jifty::Mason::Halo']
);
}
@@ -101,12 +102,6 @@
out_method => sub {
my $m = HTML::Mason::Request->instance;
my $r = $m->cgi_request;
- # Send headers if they have not been sent by us or by user.
- # We use instance here because if we store $request we get a
- # circular reference and a big memory leak.
- unless ($r->http_header_sent) {
- $r->send_http_header();
- }
$r->content_type || $r->content_type('text/html; charset=utf-8'); # Set up a default
@@ -114,6 +109,11 @@
my $enc = $1;
binmode *STDOUT, ":encoding($enc)";
}
+
+ unless ($r->http_header_sent or not $m->auto_send_headers) {
+ $r->send_http_header();
+ }
+
# We could perhaps install a new, faster out_method here that
# wouldn't have to keep checking whether headers have been
# sent and what the $r->method is. That would require
Modified: jifty/trunk/lib/Jifty/MasonHandler.pm
==============================================================================
--- jifty/trunk/lib/Jifty/MasonHandler.pm (original)
+++ jifty/trunk/lib/Jifty/MasonHandler.pm Mon Feb 6 17:42:14 2006
@@ -5,4 +5,11 @@
return %{Jifty->web->request->arguments};
}
+package Jifty::MasonRequest;
+use base qw/HTML::Mason::Request::CGI/;
+
+sub auto_send_headers {
+ return not Jifty->web->request->is_subrequest;
+}
+
1;
Modified: jifty/trunk/lib/Jifty/Request.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Request.pm (original)
+++ jifty/trunk/lib/Jifty/Request.pm Mon Feb 6 17:42:14 2006
@@ -4,7 +4,7 @@
package Jifty::Request;
use base qw/Jifty::Object Class::Accessor Clone/;
-__PACKAGE__->mk_accessors(qw(arguments just_validating path _continuation));
+__PACKAGE__->mk_accessors(qw(is_subrequest arguments just_validating path _continuation));
use Jifty::JSON;
use Jifty::YAML;
Modified: jifty/trunk/lib/Jifty/Web/PageRegion.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/PageRegion.pm (original)
+++ jifty/trunk/lib/Jifty/Web/PageRegion.pm Mon Feb 6 17:42:14 2006
@@ -243,7 +243,8 @@
# Make a fake request and throw it at the dispatcher
my $subrequest = Jifty::Request->new;
$subrequest->from_webform( %arguments );
- $subrequest->path ($self->path );
+ $subrequest->path( $self->path );
+ $subrequest->is_subrequest( 1 );
local Jifty->web->{request} = $subrequest;
# Convince Mason to tack its response onto a variable and not send
More information about the Jifty-commit
mailing list