]> Cypherpunks repositories - gostls13.git/commit
net/http/httputil: fix missing Transfer-Encoding header
authorHarshavardhana <hrshvardhana@gmail.com>
Wed, 7 Aug 2019 20:38:09 +0000 (13:38 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sat, 2 Nov 2019 19:53:12 +0000 (19:53 +0000)
commitbdb5e9d170939a044621ddaa7622ff28d538875d
tree06ac70cf5b077d3f84ab0f42cdae60d47c1c0945
parentafe50c11965ecc1e0500935a5e3fc737c9875c21
net/http/httputil: fix missing Transfer-Encoding header

Current implementation of httputil.DumpRequestOut
incorrectly resets the Request.Body prematurely
before Content-Length/Transfer-Encoding detection
in newTransferWriter()

This fix avoids resetting the Request.Body when
Request.ContentLength is set to '0' by the caller
and Request.Body is set to a custom reader. To allow
newTransferWriter() to treat this situation as
'Transfer-Encoding: chunked'.

Fixes #34504

Change-Id: Ieab6bf876ced28c32c084e0f4c8c4432964181f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/197898
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/net/http/httputil/dump.go
src/net/http/httputil/dump_test.go