Re: More CGIHandler problems

David Wheeler <[email protected]>
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
On Mar 18, 2004, at 12:57 PM, Dave Rolsky wrote:

> It doesn't send them because no output is being generated.  You're
> aborting before $m->print could ever be called.

Ah, gotcha.

> I added some explicit support for redirect aborts.  This is a bit of a
> hack, and really should be fixed in the dev code by setting a Status
> header for _all_ return codes, but I wanted to make the minimal changes
> necessary.

Yes, I think that's the right approach, at least for now.

> Anyway, all of the 09cgi.t tests now pass with the latest CVS code on 
> the
> stable branch.  And of course, the Mason core tests still pass as 
> well, so
> I think we're good to go.

I did see this during './Build test':

/Users/david/dev/perl/mason-1.2/dist/_build/lib/MyModuleBuilder.pm line 
19.

But otherwise all tests passed (not testing the Apache side at the mo, 
though).

And all of my CGI tests in MasonX::Interp::WithCallbacks pass. Yay!

I suggest we add a test or two to keep this working, eh? I've attached 
a couple.

Regards,

David
cgi.diff (application/octet-stream, 665 B)
--- 14-cgi.t.~1.6.2.1.~	Thu Mar 11 17:13:01 2004
+++ 14-cgi.t	Thu Mar 18 13:35:43 2004
@@ -104,6 +104,18 @@
 		  expect_error => qr/dead at .+/,
 		);
 
+$group->add_test( name => 'headers',
+		  description => 'Test header generation',
+		  component => q{% $r->header_out('foo' => 'bar');},
+		  expect    => qr/Foo: bar/,
+		);
+
+$group->add_test( name => 'redirect headers',
+		  description => 'Test header generation',
+		  component => q{% $m->redirect('/hello.html');},
+		  expect    => qr/Status: 302\s+Location: \/hello\.html|Location: \/hello\.html\s+Status: 302/,
+		);
+
 #------------------------------------------------------------
 
 $group->run;
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.