Based on @tiran's patch: copy the request ContentLength and TransferEncoding field in proxy

@liggitt: Update proxy content-length tests; Copy content-length in generic rest proxy.
This commit is contained in:
Chao Xu
2015-10-27 17:45:17 -07:00
parent b12550273e
commit 32f2ec71a8
4 changed files with 456 additions and 6 deletions

View File

@@ -151,6 +151,10 @@ func (r *ProxyHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
}
httpCode = http.StatusOK
newReq.Header = req.Header
newReq.ContentLength = req.ContentLength
// Copy the TransferEncoding is for future-proofing. Currently Go only supports "chunked" and
// it can determine the TransferEncoding based on ContentLength and the Body.
newReq.TransferEncoding = req.TransferEncoding
// TODO convert this entire proxy to an UpgradeAwareProxy similar to
// https://github.com/openshift/origin/blob/master/pkg/util/httpproxy/upgradeawareproxy.go.