commit 6057a9e9d6b64b81741cf0404957449c8af8529b Author: David Fifield david@bamsoftware.com Date: Sat Jul 15 12:54:06 2017 -0700
Copy multiple instances of header fields.
Just in case. Previously we only copied the first instance (as provided by Header.Get). --- appengine/reflect.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/appengine/reflect.go b/appengine/reflect.go index bc6992c..ccf11f3 100644 --- a/appengine/reflect.go +++ b/appengine/reflect.go @@ -67,9 +67,11 @@ func copyRequest(r *http.Request) (*http.Request, error) { return nil, err } for _, key := range reflectedHeaderFields { - value := r.Header.Get(key) - if value != "" { - c.Header.Add(key, value) + values, ok := r.Header[key] + if ok { + for _, value := range values { + c.Header.Add(key, value) + } } } // Set the original client IP address in a Meek-IP header. We would use @@ -106,9 +108,11 @@ func handler(w http.ResponseWriter, r *http.Request) { } defer resp.Body.Close() for _, key := range reflectedHeaderFields { - value := resp.Header.Get(key) - if value != "" { - w.Header().Add(key, value) + values, ok := resp.Header[key] + if ok { + for _, value := range values { + w.Header().Add(key, value) + } } } w.WriteHeader(resp.StatusCode)