• Joe Tsai's avatar
    net/http/httputil: fix regression in ReverseProxy.ServeHTTP · f93234ad
    Joe Tsai authored
    In Go1.12 and below, the logic in ReverseProxy.ServeHTTP would always
    allocate request.Header even if it were not present in the incoming request.
    CL 174324 added http.Request.Clone and re-factors ReverseProxy.ServeHTTP
    to use the new Clone method. However, the new Clone logic is not equivalent
    to the former logic. We preserve former semantics by explicitly allocating
    the Header map if nil.
    
    Fixes #33142
    
    Change-Id: I356f94a915dd9779584ce3fe31e56e5474b9ad37
    Reviewed-on: https://go-review.googlesource.com/c/go/+/186437
    Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarAndrew Bonventre <andybons@golang.org>
    f93234ad
reverseproxy.go 15.4 KB