Allow all CGI environment settings from the inherited set and default
inherited set to be overridden including PATH by Env.
Change-Id: Ief8d33247b879fa87a8bfd6416d4813116db98de
Reviewed-on: https://go-review.googlesource.com/14959
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
env = append(env, "CONTENT_TYPE="+ctype)
}
- if h.Env != nil {
- env = append(env, h.Env...)
- }
-
envPath := os.Getenv("PATH")
if envPath == "" {
envPath = "/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin"
}
}
+ if h.Env != nil {
+ env = append(env, h.Env...)
+ }
+
env = removeLeadingDuplicates(env)
var cwd, path string
Args: []string{cgifile},
Env: []string{
"SCRIPT_FILENAME=" + cgifile,
- "REQUEST_URI=/foo/bar"},
+ "REQUEST_URI=/foo/bar",
+ "PATH=/wibble"},
}
expectedMap := map[string]string{
"cwd": cwd,
"env-SCRIPT_FILENAME": cgifile,
"env-REQUEST_URI": "/foo/bar",
+ "env-PATH": "/wibble",
}
runCgiTest(t, h, "GET /test.cgi HTTP/1.0\nHost: example.com\n\n", expectedMap)
}