From 36286301f71bf8ebb1b4151a041599fb83fa7302 Mon Sep 17 00:00:00 2001 From: dstockton Date: Sat, 20 Oct 2018 00:24:19 +0100 Subject: [PATCH] #30: Fix the Content-Length header for HTTP2->HTTP1 --- origin/tunnel.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/origin/tunnel.go b/origin/tunnel.go index d020707b..dab1d4a6 100644 --- a/origin/tunnel.go +++ b/origin/tunnel.go @@ -431,6 +431,12 @@ func H2RequestHeadersToH1Request(h2 []h2mux.Header, h1 *http.Request) error { return fmt.Errorf("invalid path") } h1.URL = resolved + case "content-length": + contentLength, err := strconv.ParseInt(header.Value, 10, 64) + if err != nil { + return fmt.Errorf("unparseable content length") + } + h1.ContentLength = contentLength default: h1.Header.Add(http.CanonicalHeaderKey(header.Name), header.Value) }