summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2009-04-01 17:35:17 +0000
committerStefan Bühler <stbuehler@web.de>2009-04-01 17:35:17 +0000
commitce39062dd260960e927be6344a71eca4b0bef314 (patch)
tree716365970dc45a99b04792a985a919504e5e9b6a /tests
parent61332595cb69bd8315f610920fe3879ebc9fe421 (diff)
downloadlighttpd-git-ce39062dd260960e927be6344a71eca4b0bef314.tar.gz
Fix workaround for incorrect path info/scriptname if fastcgi prefix is "/" (fixes #729)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2421 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'tests')
-rw-r--r--tests/fastcgi-responder.conf12
-rw-r--r--tests/fcgi-responder.c8
-rwxr-xr-xtests/mod-fastcgi.t23
3 files changed, 39 insertions, 4 deletions
diff --git a/tests/fastcgi-responder.conf b/tests/fastcgi-responder.conf
index 6a782423..c991fbe2 100644
--- a/tests/fastcgi-responder.conf
+++ b/tests/fastcgi-responder.conf
@@ -159,3 +159,15 @@ $HTTP["host"] == "zzz.example.org" {
server.name = "zzz.example.org"
}
+$HTTP["host"] == "wsgi.example.org" {
+ fastcgi.server = (
+ "/" =>
+ ( (
+ "host" => "127.0.0.1", "port" => 10000,
+ "fix-root-scriptname" => "enable",
+ "check-local" => "disable",
+ "bin-path" => env.SRCDIR + "/fcgi-responder",
+ "max-procs" => 1,
+ ) ),
+ )
+}
diff --git a/tests/fcgi-responder.c b/tests/fcgi-responder.c
index 721c2ce2..81f8ca81 100644
--- a/tests/fcgi-responder.c
+++ b/tests/fcgi-responder.c
@@ -40,7 +40,13 @@ int main () {
printf("Status: 500 Internal Foo\r\n\r\n");
}
- printf("test123");
+ if (0 == strcmp(p, "path_info")) {
+ printf("%s", getenv("PATH_INFO"));
+ } else if (0 == strcmp(p, "script_name")) {
+ printf("%s", getenv("SCRIPT_NAME"));
+ } else {
+ printf("test123");
+ }
}
return 0;
diff --git a/tests/mod-fastcgi.t b/tests/mod-fastcgi.t
index f0ae0b48..e5057bd9 100755
--- a/tests/mod-fastcgi.t
+++ b/tests/mod-fastcgi.t
@@ -7,7 +7,7 @@ BEGIN {
}
use strict;
-use Test::More tests => 50;
+use Test::More tests => 52;
use LightyTest;
my $tf = LightyTest->new();
@@ -166,7 +166,7 @@ EOF
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/foo/bar' } ];
ok($tf->handle_http($t) == 0, 'PATH_INFO, check-local off');
-
+
ok($tf->stop_proc == 0, "Stopping lighttpd");
@@ -282,7 +282,7 @@ EOF
SKIP: {
- skip "no fcgi-responder found", 9 unless -x $tf->{BASEDIR}."/tests/fcgi-responder" || -x $tf->{BASEDIR}."/tests/fcgi-responder.exe";
+ skip "no fcgi-responder found", 11 unless -x $tf->{BASEDIR}."/tests/fcgi-responder" || -x $tf->{BASEDIR}."/tests/fcgi-responder.exe";
$tf->{CONFIGFILE} = 'fastcgi-responder.conf';
ok($tf->start_proc == 0, "Starting lighttpd with $tf->{CONFIGFILE}") or die();
@@ -319,6 +319,23 @@ EOF
ok($tf->handle_http($t) == 0, 'line-ending \r\n + \r\n');
$t->{REQUEST} = ( <<EOF
+GET /abc/def/ghi?path_info HTTP/1.0
+Host: wsgi.example.org
+EOF
+ );
+ $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/abc/def/ghi' } ];
+ ok($tf->handle_http($t) == 0, 'PATH_INFO (wsgi)');
+
+ $t->{REQUEST} = ( <<EOF
+GET /abc/def/ghi?script_name HTTP/1.0
+Host: wsgi.example.org
+EOF
+ );
+ $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '' } ];
+ ok($tf->handle_http($t) == 0, 'SCRIPT_NAME (wsgi)');
+
+
+ $t->{REQUEST} = ( <<EOF
GET /index.fcgi?die-at-end HTTP/1.0
Host: www.example.org
EOF