On Tuesday 25 September 2007 19:52, Fred Moyer wrote: > I took a quick swing at putting one together but my mod_perl environment > is a bit screwed up right now. Can you see if it runs on your setup?
With a few tweaks the test runs in my environment (trunk+2.2.6-worker). But it succeeds in both cases. I was really surprised to see this mail because my usual setup is a mix of mod_perl and mod_cgi/mod_cgid. The original post at http://marc.info/?l=apache-modperl&m=119062450730646&w=2 suggests that it may be some coincidence with keep-alive. So I even tried it via telnet: $ telnet localhost 8529 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. POST /stdin_override/mod_perl HTTP/1.1 Host: localhost Connection: keep-alive Content-Length: 9 submit=1 HTTP/1.1 200 OK Date: Tue, 25 Sep 2007 19:41:36 GMT Server: Apache/2.2.6 (Unix) DAV/2 mod_ssl/2.2.3 OpenSSL/0.9.8d mod_perl/2.0.4-dev Perl/v5.8.8 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/plain 26 MOD_PERL: mod_perl/2.0.4-dev submitted 0 POST /stdin_override/cgi HTTP/1.1 Host: localhost Connection: keep-alive Content-Length: 9 submit=1 HTTP/1.1 200 OK Date: Tue, 25 Sep 2007 19:41:39 GMT Server: Apache/2.2.6 (Unix) DAV/2 mod_ssl/2.2.3 OpenSSL/0.9.8d mod_perl/2.0.4-dev Perl/v5.8.8 Keep-Alive: timeout=5, max=99 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/plain 14 MOD_PERL: submitted 0 Connection closed by foreign host. What did I wrong? Torsten
Index: t/stdin.t =================================================================== --- t/stdin.t (revision 0) +++ t/stdin.t (revision 0) @@ -0,0 +1,24 @@ +use strict; +use warnings FATAL => 'all'; + +use Apache::Test; +use Apache::TestUtil; +use Apache::TestRequest qw(POST); + +plan tests => 2, need [qw(CGI)], + need_min_module_version CGI => 3.08; + +{ + my $url = "/stdin_override/mod_perl"; + my $res = POST $url, [submit=>1]; + + ok t_cmp($res->content, + qr{submitted}, + "form submission ok under mod_perl"); + + $url = "/stdin_override/cgi"; + $res = POST $url, [submit=>1]; + ok t_cmp($res->content, + qr{submitted}, + "stdin reset, form submission ok under cgi"); +} Index: t/conf/extra.conf.in =================================================================== --- t/conf/extra.conf.in (revision 578102) +++ t/conf/extra.conf.in (working copy) @@ -182,6 +182,24 @@ PerlResponseHandler ModPerl::Registry </Location> +### test for mixed mod_perl/cgi environment ### +<IfModule mod_alias.c> + Alias /stdin_override/mod_perl @ServerRoot@/cgi-bin/stdin.pl + Alias /stdin_override/cgi @ServerRoot@/cgi-bin/stdin.pl +</IfModule> + +<Location /stdin_override/mod_perl> + SetHandler perl-script + PerlResponseHandler ModPerl::Registry + PerlOptions +ParseHeaders + Options +ExecCGI +</Location> + +<Location /stdin_override/cgi> + SetHandler cgi-script + Options +ExecCGI +</Location> + ### deflate tests ### <IfModule mod_alias.c> Alias /registry_bb_deflate/ @ServerRoot@/cgi-bin/ Index: t/cgi-bin/stdin.pl =================================================================== --- t/cgi-bin/stdin.pl (revision 0) +++ t/cgi-bin/stdin.pl (revision 0) @@ -0,0 +1,18 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use CGI qw/:standard/; + +print <<END; +Content-type: text/plain + +END + +if (param()) { + my $submit = param('submit'); + if ($submit) { + print "submitted"; + } +} Property changes on: t/cgi-bin/stdin.pl ___________________________________________________________________ Name: svn:executable + *
pgpPQrKsFuN1p.pgp
Description: PGP signature