[Mungo-devel] [mungo commit] r108 - in trunk: lib/Mungo t

svn-commit at lists.omniti.com svn-commit at lists.omniti.com
Tue Jan 26 19:59:18 EST 2010


Author: jesus
Date: 2010-01-26 19:59:18 -0500 (Tue, 26 Jan 2010)
New Revision: 108

Modified:
   trunk/lib/Mungo/Response.pm
   trunk/t/11-redirect.t
Log:
Fixes #30 and updates to tests to make sure the output is the new expected behaviour

Modified: trunk/lib/Mungo/Response.pm
===================================================================
--- trunk/lib/Mungo/Response.pm	2010-01-26 23:31:21 UTC (rev 107)
+++ trunk/lib/Mungo/Response.pm	2010-01-27 00:59:18 UTC (rev 108)
@@ -450,7 +450,17 @@
       print $$obj;
     }
   }
-  $self->Flush();
+  # If we have any data to write, or have written anything
+  # then the ball in our court.
+  # However, if we haven't, we should pass the status back
+  # from the main handler so that Apache ErrorDocs wil work.
+  if(($_r->{data}->{Buffer} && length($one_true_buffer)) ||
+     $_r->{data}->{'__OUTPUT_STARTED__'}) {
+    $self->Flush();
+  }
+  else {
+    $self->{Mungo}->{data}->{ApacheResponseCode} = $_r->{data}->{Status};
+  }
   eval { goto  MUNGO_HANDLER_FINISH; }; # Jump back to Mungo::handler()
 }
 

Modified: trunk/t/11-redirect.t
===================================================================
--- trunk/t/11-redirect.t	2010-01-26 23:31:21 UTC (rev 107)
+++ trunk/t/11-redirect.t	2010-01-27 00:59:18 UTC (rev 108)
@@ -49,13 +49,13 @@
           'no-following-text' => {
                                   label => "Page with text after redirect",
                                   status => 302,
-                                  initial_like => qr{^$},
+                                  initial_like => qr{302 Found},
                                   redirect_like => qr{^mungo-redirect-success$},
                                  },
           'headers-preceding-redirect' => {
                                            label => "Page with headers prior to redirect",
                                            status => 302,
-                                           initial_like => qr{^$},
+                                           initial_like => qr{302 Found},
                                            initial_header => [ 'X-mungo-test-header' => 'ponies' ],
                                            redirect_like => qr{^mungo-redirect-success$},
                                            #todo => "",



More information about the Mungo-devel mailing list