This file documents the revision history for Perl extension Catalyst.
+5.62
+ - Added REDIRECT_URL support for applications running behind
+ a RewriteRule in Apache. (Carl Franks)
+
5.61 2005-12-02 00:00:00
- Fixed ExtUtils::AutoInstall Bootstrap Code in Makefile.PL
my $scheme = $c->request->secure ? 'https' : 'http';
my $host = $ENV{HTTP_HOST} || $ENV{SERVER_NAME};
my $port = $ENV{SERVER_PORT} || 80;
- my $base_path = $ENV{SCRIPT_NAME} || '/';
+ my $base_path;
+ if ( exists $ENV{REDIRECT_URL} ) {
+ $base_path = $ENV{REDIRECT_URL};
+ $base_path =~ s/$ENV{PATH_INFO}$//;
+ }
+ else {
+ $base_path = $ENV{SCRIPT_NAME} || '/';
+ }
# If we are running as a backend proxy, get the true hostname
PROXY_CHECK:
# CGI
<IfModule @CGI_MODULE@>
ScriptAlias /cgi/ @ServerRoot@/tmp/TestApp/script/testapp_cgi.pl/
+
+ # REDIRECT_URL test
+ <IfModule mod_rewrite.c>
+ <Location /rewrite>
+ RewriteEngine on
+ RewriteRule /rewrite/(.*) /cgi/$1
+ </Location>
+ </IfModule>
</IfModule>
# FastCGI
<IfModule mod_fastcgi.c>
FastCgiIpcDir @ServerRoot@/tmp/tmp
- FastCgiServer @ServerRoot@/tmp/TestApp/script/testapp_fastcgi.pl -idle-timeout 300 -processes 5
+ FastCgiServer @ServerRoot@/tmp/TestApp/script/testapp_fastcgi.pl -idle-timeout 300 -processes 1
ScriptAlias /fastcgi/ @ServerRoot@/tmp/TestApp/script/testapp_fastcgi.pl/
</IfModule>
--- /dev/null
+#!perl
+
+# Run all tests against CGI mode under Apache
+#
+# Note, to get this to run properly, you may need to give it the path to your
+# httpd.conf:
+#
+# perl t/optional/apache-cgi.pl -httpd_conf /etc/apache/httpd.conf
+
+use strict;
+use warnings;
+
+use Apache::Test;
+use Apache::TestRun ();
+
+use File::Path;
+use File::Copy::Recursive;
+use FindBin;
+use IO::Socket;
+
+# clean up
+rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp";
+
+# create a TestApp and copy the test libs into it
+mkdir "$FindBin::Bin/../t/tmp";
+chdir "$FindBin::Bin/../t/tmp";
+system "$FindBin::Bin/../script/catalyst.pl TestApp";
+chdir "$FindBin::Bin/..";
+File::Copy::Recursive::dircopy( 't/lib', 't/tmp/TestApp/lib' );
+
+# remove TestApp's tests so Apache::Test doesn't try to run them
+rmtree 't/tmp/TestApp/t';
+
+$ENV{CATALYST_SERVER} = 'http://localhost:8529/rewrite';
+
+Apache::TestRun->new->run(@ARGV);
+
+# clean up if the server has shut down
+# this allows the test files to stay around if the user ran -start-httpd
+if ( !check_port( 'localhost', 8529 ) ) {
+ rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp";
+}
+
+sub check_port {
+ my ( $host, $port ) = @_;
+
+ my $remote = IO::Socket::INET->new(
+ Proto => "tcp",
+ PeerAddr => $host,
+ PeerPort => $port
+ );
+ if ($remote) {
+ close $remote;
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}