Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 38d2e7e

Browse files
committed
Test FPM FCGI envs with path info fix for Apache proxy pass
1 parent 8cf621e commit 38d2e7e

File tree

2 files changed

+108
-0
lines changed

2 files changed

+108
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
--TEST--
2+
FPM: FastCGI env var path info fix for Apache ProxyPass SCRIPT_NAME stripping with basic path
3+
--SKIPIF--
4+
<?php include "skipif.inc"; ?>
5+
--FILE--
6+
<?php
7+
8+
require_once "tester.inc";
9+
10+
$cfg = <<<EOT
11+
[global]
12+
error_log = {{FILE:LOG}}
13+
[unconfined]
14+
listen = {{ADDR}}
15+
pm = dynamic
16+
pm.max_children = 5
17+
pm.start_servers = 1
18+
pm.min_spare_servers = 1
19+
pm.max_spare_servers = 3
20+
php_admin_value[cgi.fix_pathinfo] = yes
21+
EOT;
22+
23+
$code = <<<EOT
24+
<?php
25+
echo \$_SERVER["SCRIPT_NAME"] . "\n";
26+
echo \$_SERVER["ORIG_SCRIPT_NAME"] . "\n";
27+
echo \$_SERVER["SCRIPT_FILENAME"] . "\n";
28+
echo \$_SERVER["PATH_INFO"] . "\n";
29+
echo \$_SERVER["PHP_SELF"];
30+
EOT;
31+
32+
$tester = new FPM\Tester($cfg, $code);
33+
[$sourceFilePath, $scriptName] = $tester->createSourceFileAndScriptName();
34+
$tester->start();
35+
$tester->expectLogStartNotices();
36+
$tester
37+
->request(
38+
uri: $scriptName . '/pinfo',
39+
scriptFilename: "proxy:fcgi://" . $tester->getAddr() . $sourceFilePath . '/pinfo',
40+
scriptName: $scriptName . '/pinfo'
41+
)
42+
->expectBody([$scriptName, $scriptName . '/pinfo', $sourceFilePath, '/pinfo', $scriptName . '/pinfo']);
43+
$tester->terminate();
44+
$tester->close();
45+
46+
?>
47+
Done
48+
--EXPECT--
49+
Done
50+
--CLEAN--
51+
<?php
52+
require_once "tester.inc";
53+
FPM\Tester::clean();
54+
?>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
--TEST--
2+
FPM: FastCGI env var path info fix for Apache ProxyPass SCRIPT_NAME stripping with invalid path
3+
--SKIPIF--
4+
<?php include "skipif.inc"; ?>
5+
--FILE--
6+
<?php
7+
8+
require_once "tester.inc";
9+
10+
$cfg = <<<EOT
11+
[global]
12+
error_log = {{FILE:LOG}}
13+
[unconfined]
14+
listen = {{ADDR}}
15+
pm = dynamic
16+
pm.max_children = 5
17+
pm.start_servers = 1
18+
pm.min_spare_servers = 1
19+
pm.max_spare_servers = 3
20+
php_admin_value[cgi.fix_pathinfo] = yes
21+
EOT;
22+
23+
$code = <<<EOT
24+
<?php
25+
echo \$_SERVER["SCRIPT_NAME"] . "\n";
26+
echo \$_SERVER["ORIG_SCRIPT_NAME"] ?? 'none' . "\n";
27+
echo \$_SERVER["SCRIPT_FILENAME"] . "\n";
28+
echo \$_SERVER["PATH_INFO"] . "\n";
29+
echo \$_SERVER["PHP_SELF"];
30+
EOT;
31+
32+
$tester = new FPM\Tester($cfg, $code);
33+
[$sourceFilePath, $scriptName] = $tester->createSourceFileAndScriptName();
34+
$tester->start();
35+
$tester->expectLogStartNotices();
36+
$tester
37+
->request(
38+
uri: $scriptName . '/pinfox',
39+
scriptFilename: "proxy:fcgi://" . $tester->getAddr() . $sourceFilePath . '/pinfoy',
40+
scriptName: $scriptName . '/pinfox' // this would be a bug in Apache - just for testing
41+
)
42+
->expectBody([$scriptName . '/pinfox', 'none', $sourceFilePath, '/pinfoy', $scriptName . '/pinfox/pinfoy']);
43+
$tester->terminate();
44+
$tester->close();
45+
46+
?>
47+
Done
48+
--EXPECT--
49+
Done
50+
--CLEAN--
51+
<?php
52+
require_once "tester.inc";
53+
FPM\Tester::clean();
54+
?>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /