mirror of
https://github.com/openfaas/faas.git
synced 2025-06-20 13:06:40 +00:00
Add transfer-encoding to watchdog env-vars if present
The Content-Type header must be ignored when the Transfer Encoding is set to "chunked" because the length is unknown Go sets this to -1 and we pass that onto the user: https://golang.org/src/net/http/transfer.go The value of Content_Length is currently set to -1 in this scenario, however it caused some confusion for at least one user in issue: #1422. The Http_Transfer_Encoding value was tested by running the watchdog on Linux with "env" as the fprocess and an extra header to "curl" Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
committed by
Alex Ellis
parent
09b867559d
commit
6a30ce1e36
@ -237,6 +237,10 @@ func getAdditionalEnvs(config *WatchdogConfig, r *http.Request, method string) [
|
||||
envs = append(envs, fmt.Sprintf("Http_ContentLength=%d", r.ContentLength))
|
||||
envs = append(envs, fmt.Sprintf("Http_Content_Length=%d", r.ContentLength))
|
||||
|
||||
if len(r.TransferEncoding) > 0 {
|
||||
envs = append(envs, fmt.Sprintf("Http_Transfer_Encoding=%s", r.TransferEncoding[0]))
|
||||
}
|
||||
|
||||
if config.writeDebug {
|
||||
log.Println("Query ", r.URL.RawQuery)
|
||||
}
|
||||
|
Reference in New Issue
Block a user