[Rt-commit] r3696 - HTTP-Server-Simple-Mason/lib/HTTP/Server/Simple

glasser at bestpractical.com glasser at bestpractical.com
Thu Aug 18 18:51:35 EDT 2005


Author: glasser
Date: Thu Aug 18 18:51:35 2005
New Revision: 3696

Modified:
   HTTP-Server-Simple-Mason/lib/HTTP/Server/Simple/Mason.pm
Log:
Switch back from $r to $m.  (Probably this will be rolled way back.)

Modified: HTTP-Server-Simple-Mason/lib/HTTP/Server/Simple/Mason.pm
==============================================================================
--- HTTP-Server-Simple-Mason/lib/HTTP/Server/Simple/Mason.pm	(original)
+++ HTTP-Server-Simple-Mason/lib/HTTP/Server/Simple/Mason.pm	Thu Aug 18 18:51:35 2005
@@ -39,13 +39,18 @@
 use Hook::LexWrap;
 
 wrap 'HTML::Mason::FakeApache::send_http_header', pre => sub {
+    # If we've already sent the HTTP header, don't try to again.
+    if (not HTML::Mason::Request->instance or
+            HTML::Mason::Request->instance->{'_hssm_http_header_sent'}) {
+        $_[-1] = "1";
+        return;
+    }
+
     my $r = shift;
 
-    # If we've already sent the HTTP header, don't try to again.
-    if ($r->{'_hssm_http_header_sent'}) {$_[-1] = "1"; return;}
     my $status = $r->header_out('Status') || '200 H::S::Mason OK';
     print STDOUT "HTTP/1.0 $status\n";
-    $r->{'_hssm_http_header_sent'} = 1;
+    HTML::Mason::Request->instance->{'_hssm_http_header_sent'} = 1;
 };
 
 =head2 mason_handler 
@@ -137,7 +142,7 @@
             # 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->{'_hssm_http_header_sent'}) {
+                unless ($m->{'_hssm_http_header_sent'}) {
                        $r->send_http_header();
                 }
             {


More information about the Rt-commit mailing list