File tree Expand file tree Collapse file tree 2 files changed +27
-5
lines changed Expand file tree Collapse file tree 2 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -36,12 +36,12 @@ func (p *Server) generateEnv(req *http.Request) map[string]string {
36
36
https = "On"
37
37
}
38
38
39
- pathInfo := ""
40
- if pos := strings .Index (strings .ToLower (req . RequestURI ), ".php" ); pos != - 1 {
41
- file := req . RequestURI [:pos + 4 ]
39
+ pathInfo := req . URL . Path
40
+ if pos := strings .Index (strings .ToLower (pathInfo ), ".php" ); pos != - 1 {
41
+ file := pathInfo [:pos + 4 ]
42
42
if _ , err := os .Stat (filepath .Join (p .documentRoot , file )); err == nil {
43
43
scriptName = file
44
- pathInfo = req . RequestURI [pos + 4 :]
44
+ pathInfo = pathInfo [pos + 4 :]
45
45
}
46
46
}
47
47
Original file line number Diff line number Diff line change @@ -43,13 +43,24 @@ func (s *PHPFPMSuite) TestGenerateEnv(c *C) {
43
43
passthru : "/index.php" ,
44
44
uri : "/" ,
45
45
expected : map [string ]string {
46
- "PATH_INFO" : "" ,
46
+ "PATH_INFO" : "/ " ,
47
47
"REQUEST_URI" : "/" ,
48
48
"QUERY_STRING" : "" ,
49
49
"SCRIPT_FILENAME" : testdataDir + "/public/index.php" ,
50
50
"SCRIPT_NAME" : "/index.php" ,
51
51
},
52
52
},
53
+ {
54
+ passthru : "/index.php" ,
55
+ uri : "/?foo=bar" ,
56
+ expected : map [string ]string {
57
+ "PATH_INFO" : "/" ,
58
+ "REQUEST_URI" : "/" ,
59
+ "QUERY_STRING" : "foo=bar" ,
60
+ "SCRIPT_FILENAME" : testdataDir + "/public/index.php" ,
61
+ "SCRIPT_NAME" : "/index.php" ,
62
+ },
63
+ },
53
64
{
54
65
passthru : "/index.php" ,
55
66
uri : "/index.php" ,
@@ -83,6 +94,17 @@ func (s *PHPFPMSuite) TestGenerateEnv(c *C) {
83
94
"SCRIPT_NAME" : "/app.PHP" ,
84
95
},
85
96
},
97
+ {
98
+ passthru : "/index.php" ,
99
+ uri : "/index.php/foo?foo=bar" ,
100
+ expected : map [string ]string {
101
+ "PATH_INFO" : "/foo" ,
102
+ "REQUEST_URI" : "/index.php/foo?foo=bar" ,
103
+ "QUERY_STRING" : "foo=bar" ,
104
+ "SCRIPT_FILENAME" : testdataDir + "/public/index.php" ,
105
+ "SCRIPT_NAME" : "/index.php" ,
106
+ },
107
+ },
86
108
{
87
109
passthru : "/index.php" ,
88
110
uri : "/foo" ,
You can’t perform that action at this time.
0 commit comments