concatenate Cookie HPACK headers for the HTTP request

fixes #338
This commit is contained in:
Marten Seemann
2016-10-30 12:13:01 +07:00
committed by Lucas Clemente
parent bb24be8281
commit 76cf0a2345
2 changed files with 21 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ import (
"net/http"
"net/url"
"strconv"
"strings"
"golang.org/x/net/http2/hpack"
)
@@ -30,6 +31,11 @@ func requestFromHeaders(headers []hpack.HeaderField) (*http.Request, error) {
}
}
// concatenate cookie headers, see https://tools.ietf.org/html/rfc6265#section-5.4
if len(httpHeaders["Cookie"]) > 0 {
httpHeaders.Set("Cookie", strings.Join(httpHeaders["Cookie"], "; "))
}
if len(path) == 0 || len(authority) == 0 || len(method) == 0 {
return nil, errors.New(":path, :authority and :method must not be empty")
}