• Harshavardhana's avatar
    net/http/httputil: fix missing Transfer-Encoding header · bdb5e9d1
    Harshavardhana authored
    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/+/197898Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    bdb5e9d1
dump.go 9.2 KB