Skip to content

Commit

Permalink
http2: don't pass on Connection: headers
Browse files Browse the repository at this point in the history
RFC 7540 section 8.1.2.2 states: "An endpoint MUST NOT generate an
HTTP/2 message containing connection-specific header fields; any message
containing connection-specific header fields MUST be treated as
malformed"

Closes #401
  • Loading branch information
bagder committed Sep 3, 2015
1 parent 4ceddcf commit 1869164
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/http2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1290,10 +1290,14 @@ static ssize_t http2_send(struct connectdata *conn, int sockindex,
authority_idx = 0;

for(i = 3; i < nheader; ++i) {
size_t hlen;
end = strchr(hdbuf, ':');
if(!end)
goto fail;
if(end - hdbuf == 4 && Curl_raw_nequal("host", hdbuf, 4)) {
hlen = end - hdbuf;
if(hlen == 10 && Curl_raw_nequal("connection", hdbuf, 10))
; /* skip Connection: headers! */
else if(hlen == 4 && Curl_raw_nequal("host", hdbuf, 4)) {
authority_idx = i;
nva[i].name = (unsigned char *)":authority";
nva[i].namelen = (uint16_t)strlen((char *)nva[i].name);
Expand Down

0 comments on commit 1869164

Please sign in to comment.