use TestApp;
use Catalyst::Engine::CGI;
-my %template = (
- HTTP_HOST => 'www.foo.com',
- PATH_INFO => '/',
-);
-
# mod_rewrite to app root for non / based app
{
my $r = get_req (
is ''.$r->base, 'http://www.foo.com/~bobtfish/Gitalist/script/gitalist.cgi/';
}
+# Using rewrite rules to ask for a sub-path in your app.
+# E.g. RewriteRule ^(.*)$ /path/to/fastcgi/domainprofi.fcgi/iframeredirect$1 [L,NS]
+{
+ my $r = get_req (
+ PATH_INFO => '/iframeredirect/info',
+ SCRIPT_NAME => '',
+ REQUEST_URI => '/info',
+ );
+ is ''.$r->uri, 'http://www.foo.com/iframeredirect/info';
+ is ''.$r->base, 'http://www.foo.com/';
+}
+
+# nginx example from espent with path /"foo"
+{
+ my $r = get_req (
+ PATH_INFO => '"foo"',
+ SCRIPT_NAME => '/',
+ REQUEST_URI => '/%22foo%22',
+ );
+ is ''.$r->path, '%22foo%22';
+ is ''.$r->uri, 'http://www.foo.com/%22foo%22';
+ is ''.$r->base, 'http://www.foo.com/';
+}
+
+# nginx example from espent with path /"foo" and the app based at /oslobilder
+{
+ my $r = get_req (
+ PATH_INFO => 'oslobilder/"foo"',
+ SCRIPT_NAME => '/oslobilder/',
+ REQUEST_URI => '/oslobilder/%22foo%22',
+ );
+ is ''.$r->path, '%22foo%22';
+ is ''.$r->uri, 'http://www.foo.com/oslobilder/%22foo%22';
+ is ''.$r->base, 'http://www.foo.com/oslobilder/';
+}
+
+
+
+
# FIXME - Test proxy logic
# - Test query string
# - Test non standard port numbers
# - Test scheme (secure request on port 80)
sub get_req {
+ my %template = (
+ HTTP_HOST => 'www.foo.com',
+ PATH_INFO => '/',
+ );
+
local %ENV = (%template, @_);
+
my $i = TestApp->new;
$i->engine(Catalyst::Engine::CGI->new);
$i->engine->prepare_path($i);