#30: Fix the Content-Length header for HTTP2->HTTP1

This commit is contained in:
dstockton 2018-10-20 00:24:19 +01:00 committed by Silver
parent 9fe21fa906
commit 36286301f7
1 changed files with 6 additions and 0 deletions

View File

@ -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)
}