From: Andy Grundman Date: Tue, 7 Nov 2006 17:23:09 +0000 (+0000) Subject: Moved IE workarounds to be only in the HTTP engine X-Git-Tag: 5.7099_04~290 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=00c9932455ecd6ca565d60d76180a2d850b7317b Moved IE workarounds to be only in the HTTP engine --- diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index f075890..3a73c04 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -579,8 +579,6 @@ sub write { $self->prepare_write($c); $self->{_prepared_write} = 1; } - - return unless *STDOUT->opened(); print STDOUT $buffer; } diff --git a/lib/Catalyst/Engine/CGI.pm b/lib/Catalyst/Engine/CGI.pm index bd47286..17e4eed 100644 --- a/lib/Catalyst/Engine/CGI.pm +++ b/lib/Catalyst/Engine/CGI.pm @@ -43,8 +43,8 @@ sub finalize_headers { $c->response->header( Status => $c->response->status ); - print $c->response->headers->as_string("\015\012") if *STDOUT->opened(); - print "\015\012" if *STDOUT->opened(); + print $c->response->headers->as_string("\015\012"); + print "\015\012"; } =head2 $self->prepare_connection($c) diff --git a/lib/Catalyst/Engine/HTTP.pm b/lib/Catalyst/Engine/HTTP.pm index 6da9325..808cbca 100644 --- a/lib/Catalyst/Engine/HTTP.pm +++ b/lib/Catalyst/Engine/HTTP.pm @@ -50,7 +50,12 @@ sub finalize_headers { $c->response->headers->date(time); $c->response->headers->header( Connection => $self->_keep_alive ? 'keep-alive' : 'close' ); - $self->NEXT::finalize_headers($c); + + $c->response->header( Status => $c->response->status ); + + # Avoid 'print() on closed filehandle Remote' warnings when using IE + print $c->response->headers->as_string("\015\012") if *STDOUT->opened(); + print "\015\012" if *STDOUT->opened(); } =head2 $self->finalize_read($c) @@ -106,6 +111,19 @@ sub read_chunk { } } +=head2 $self->write($c, $buffer) + +Writes the buffer to the client. Can only be called once for a request. + +=cut + +sub write { + # Avoid 'print() on closed filehandle Remote' warnings when using IE + return unless *STDOUT->opened(); + + shift->NEXT::write( @_ ); +} + =head2 run =cut