fix Content-length header and body sending of POST requests

This commit is contained in:
seroy 2018-05-17 01:21:44 +03:00
parent 75d7561b5d
commit a6892c526d
1 changed files with 6 additions and 0 deletions

View File

@ -378,6 +378,12 @@ func H2RequestHeadersToH1Request(h2 []h2mux.Header, h1 *http.Request) error {
return fmt.Errorf("invalid path")
}
h1.URL = resolved
case "content-length":
l, err := strconv.ParseInt(header.Value, 10, 64)
if err != nil {
return fmt.Errorf("unparseable content length")
}
h1.ContentLength = l
default:
h1.Header.Add(http.CanonicalHeaderKey(header.Name), header.Value)
}