• Brad Fitzpatrick's avatar
    net/http/httputil: make ReverseProxy support Trailers · 72970f7f
    Brad Fitzpatrick authored
    Go's continuous build system depends on HTTP trailers for the buildlet
    interface.
    
    Andrew rewrote the makerelease tool to work in terms of Go's builder
    system (now at x/build/cmd/release), but it previously could only
    create GCE-based buildlets, which meant x/build/cmd/release couldn't
    build the release for Darwin.
    
    https://golang.org/cl/11901 added support for proxying buildlet
    connections via the coordinator, but that exposed the fact that
    httputil.ReverseProxy couldn't proxy Trailers. A fork of that code
    also wasn't possible because net/http needlessly deleted the "Trailer"
    response header in the Transport code.  This mistake goes back to
    "release-branch.r56" and earlier but was never noticed because nobody
    ever uses Trailers, and servers via ResponseWriter never had the
    ability to even set trailers before this Go 1.5. Note that setting
    trailers requires pre-declaring (in the response header) which
    trailers you'll set later (after the response body). Because you could
    never set them, before this release you could also never proxy them.
    
    Change-Id: I2410a099921790dcd391675ae8610300efa19108
    Reviewed-on: https://go-review.googlesource.com/11940Reviewed-by: 's avatarAndrew Gerrand <adg@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    72970f7f
reverseproxy.go 6.88 KB