• Brad Fitzpatrick's avatar
    net/http/httputil: make ReverseProxy send nil Body requests when possible · 7cbc1058
    Brad Fitzpatrick authored
    The http.Transport's retry can't retry requests with non-nil
    bodies. When cloning an incoming server request into an outgoing
    client request, nil out the Body field if the ContentLength is 0. (For
    server requests, Body is always non-nil, even for GET, HEAD, etc.)
    
    Also, don't use the deprecated CancelRequest and use Context instead.
    
    And don't set Proto, ProtoMajor, ProtoMinor. Those are ignored in
    client requests, which was probably a later documentation
    clarification.
    
    Fixes #16036
    Updates #16696 (remove useless Proto lines)
    
    Change-Id: I70a869e9bd4bf240c5838e82fb5aa695a539b343
    Reviewed-on: https://go-review.googlesource.com/28412
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarJoe Tsai <thebrokentoaster@gmail.com>
    7cbc1058
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...