author | Roland Shoemaker
<rolandshoemaker@gmail.com> 2016-04-03 19:24:15 UTC |
committer | Brad Fitzpatrick
<bradfitz@golang.org> 2016-04-03 19:55:14 UTC |
parent | 3e8a7b0329d536af18e227bb21b6da4d1dbbe180 |
http2/transport.go | +3 | -6 |
http2/transport_test.go | +5 | -0 |
diff --git a/http2/transport.go b/http2/transport.go index 52ee68d..b5907da 100644 --- a/http2/transport.go +++ b/http2/transport.go @@ -945,14 +945,11 @@ func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trail // Host is :authority, already sent. // Content-Length is automatic, set below. continue - case "connection", "proxy-connection", "transfer-encoding", "upgrade": + case "connection", "proxy-connection", "transfer-encoding", "upgrade", "keep-alive": // Per 8.1.2.2 Connection-Specific Header // Fields, don't send connection-specific - // fields. We deal with these earlier in - // RoundTrip, deciding whether they're - // error-worthy, but we don't want to mutate - // the user's *Request so at this point, just - // skip over them at this point. + // fields. We have already checked if any + // are error-worthy so just ignore the rest. continue case "user-agent": // Match Go's http1 behavior: at most one diff --git a/http2/transport_test.go b/http2/transport_test.go index 07598b2..bcc2a5f 100644 --- a/http2/transport_test.go +++ b/http2/transport_test.go @@ -1642,6 +1642,11 @@ func TestTransportRejectsConnHeaders(t *testing.T) { value: []string{"123"}, want: "Accept-Encoding,User-Agent", }, + { + key: "Keep-Alive", + value: []string{"doop"}, + want: "Accept-Encoding,User-Agent", + }, } for _, tt := range tests {