You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by ge...@apache.org on 2007/10/05 15:53:42 UTC

svn commit: r582270 - in /perl/modperl/trunk/ModPerl-Registry/t: cgi-bin/env_val.pl conf/extra.conf.in rewrite_env.t

Author: geoff
Date: Fri Oct  5 06:53:40 2007
New Revision: 582270

URL: http://svn.apache.org/viewvc?rev=582270&view=rev
Log:
add simple mod_rewrite env test

http://issues.apache.org/bugzilla/show_bug.cgi?id=43514

Added:
    perl/modperl/trunk/ModPerl-Registry/t/cgi-bin/env_val.pl   (with props)
    perl/modperl/trunk/ModPerl-Registry/t/rewrite_env.t
Modified:
    perl/modperl/trunk/ModPerl-Registry/t/conf/extra.conf.in

Added: perl/modperl/trunk/ModPerl-Registry/t/cgi-bin/env_val.pl
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/ModPerl-Registry/t/cgi-bin/env_val.pl?rev=582270&view=auto
==============================================================================
--- perl/modperl/trunk/ModPerl-Registry/t/cgi-bin/env_val.pl (added)
+++ perl/modperl/trunk/ModPerl-Registry/t/cgi-bin/env_val.pl Fri Oct  5 06:53:40 2007
@@ -0,0 +1,7 @@
+# test env vars
+
+print "Content-type: text/plain\n\n";
+my $var = $ENV{QUERY_STRING};
+print exists $ENV{$var} && $ENV{$var};
+
+__END__

Propchange: perl/modperl/trunk/ModPerl-Registry/t/cgi-bin/env_val.pl
------------------------------------------------------------------------------
    svn:executable = *

Modified: perl/modperl/trunk/ModPerl-Registry/t/conf/extra.conf.in
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/ModPerl-Registry/t/conf/extra.conf.in?rev=582270&r1=582269&r2=582270&view=diff
==============================================================================
--- perl/modperl/trunk/ModPerl-Registry/t/conf/extra.conf.in (original)
+++ perl/modperl/trunk/ModPerl-Registry/t/conf/extra.conf.in Fri Oct  5 06:53:40 2007
@@ -45,6 +45,7 @@
     Alias /perlrun_prefork/  @ServerRoot@/cgi-bin/
     Alias /nph/              @ServerRoot@/cgi-bin/
     Alias /registry_modperl_handler/  @ServerRoot@/cgi-bin/
+    Alias /rewrite_env/      @ServerRoot@/cgi-bin/
 
     ScriptAlias /cgi-bin/ @ServerRoot@/cgi-bin/
 </IfModule>
@@ -218,5 +219,21 @@
     SetEnv TMPDIR @t_logs@
 </IfModule>
 # </sandbox-friendly>
+
+
+<IfModule mod_rewrite.c>
+
+    RewriteEngine On
+    RewriteLogLevel 9
+    RewriteLog @ServerRoot@/logs/rewrite_log
+    RewriteRule /rewritetest /rewrite_env/env_val.pl?REWRITE_TEST [E=REWRITE_TEST:GOTCHA,PT,NS,L]
+
+    <Location /rewrite_env>
+        SetHandler perl-script
+        PerlResponseHandler ModPerl::Registry
+        Options +ExecCGI
+        PerlOptions +ParseHeaders
+    </Location>
+</IfModule>
 
 

Added: perl/modperl/trunk/ModPerl-Registry/t/rewrite_env.t
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/ModPerl-Registry/t/rewrite_env.t?rev=582270&view=auto
==============================================================================
--- perl/modperl/trunk/ModPerl-Registry/t/rewrite_env.t (added)
+++ perl/modperl/trunk/ModPerl-Registry/t/rewrite_env.t Fri Oct  5 06:53:40 2007
@@ -0,0 +1,17 @@
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestUtil;
+use Apache::TestRequest qw(GET);
+
+plan tests => 1, need [qw(mod_alias.c mod_rewrite.c)];
+
+{
+    my $url = "/rewritetest";
+    my $res = GET $url;
+
+    ok t_cmp($res->content(),
+             "GOTCHA",
+             'found environment variable from mod_rewrite');
+}