• 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
..
dump.go Loading commit data...
dump_test.go Loading commit data...
example_test.go Loading commit data...
httputil.go Loading commit data...
persist.go Loading commit data...
reverseproxy.go Loading commit data...
reverseproxy_test.go Loading commit data...