Headers Sent Twice

David Wheeler <[email protected]>
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
Hi All,

Here's a patch against ApacheHandler to keep it from sending headers 
during an abort or redirect when they've already been sent. I ran into 
this for when I've got a callback that sends content to the browser 
before it aborts (and this is before a request object is created).

--- ApacheHandler.pm.~1.294.2.5.~	Thu Mar 11 17:12:57 2004
+++ ApacheHandler.pm	Fri Apr 30 18:48:30 2004
@@ -880,7 +880,8 @@
  	my $retval = isa_mason_exception($err, 'Abort')   ? 
$err->aborted_value  :
  		     isa_mason_exception($err, 'Decline') ? $err->declined_value :
  		     rethrow_exception $err;
-        $r->send_http_header unless $retval and $retval != 200;
+        $r->send_http_header unless $r->header_out("Content-type")
+          || ($retval and $retval != 200);
  	return $retval;
      }

Thanks,

David



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE. 
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.