Skip to content
Snippets Groups Projects
Commit 6d436c57 authored by Alex's avatar Alex
Browse files

watchdog - Write out headers with underscores


Signed-off-by: default avatarAlex <alexellis2@gmail.com>
parent 77f63be0
No related branches found
No related tags found
No related merge requests found
......@@ -150,10 +150,10 @@ func pipeRequest(config *WatchdogConfig, w http.ResponseWriter, r *http.Request,
w.WriteHeader(http.StatusInternalServerError)
response := bytes.NewBufferString(err.Error())
w.Write(response.Bytes())
w.Write([]byte("\n"))
if len(out) > 0 {
w.Write(out)
}
w.Write([]byte("\n"))
if len(out) > 0 {
w.Write(out)
}
ri.headerWritten = true
}
return
......@@ -194,9 +194,10 @@ func getAdditionalEnvs(config *WatchdogConfig, r *http.Request, method string) [
if config.cgiHeaders {
envs = os.Environ()
for k, v := range r.Header {
kv := fmt.Sprintf("Http_%s=%s", k, v[0])
kv := fmt.Sprintf("Http_%s=%s", strings.Replace(k, "-", "_", -1), v[0])
envs = append(envs, kv)
}
envs = append(envs, fmt.Sprintf("Http_Method=%s", method))
if len(r.URL.RawQuery) > 0 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment