mirror of
https://github.com/curl/curl.git
synced 2026-07-26 20:17:18 +03:00
Curl_http(), decomplexify
Split out adding of individual request headers into a switch. Check the connection http version only on fresh connections, use separate methods. Add TE: header directly without allocation. Add bit for indicating Connection: header has been added and custom headers should not do that again. Closes #18444
This commit is contained in:
parent
e00cb001c6
commit
4d040c71d7
25 changed files with 345 additions and 319 deletions
8
lib/ws.c
8
lib/ws.c
|
|
@ -1023,11 +1023,6 @@ CURLcode Curl_ws_request(struct Curl_easy *data, struct dynbuf *req)
|
|||
MUST include the "websocket" keyword. */
|
||||
"Upgrade", "websocket"
|
||||
},
|
||||
{
|
||||
/* The request MUST contain a |Connection| header field whose value
|
||||
MUST include the "Upgrade" token. */
|
||||
"Connection", "Upgrade",
|
||||
},
|
||||
{
|
||||
/* The request MUST include a header field with the name
|
||||
|Sec-WebSocket-Version|. The value of this header field MUST be
|
||||
|
|
@ -1043,7 +1038,7 @@ CURLcode Curl_ws_request(struct Curl_easy *data, struct dynbuf *req)
|
|||
"Sec-WebSocket-Key", NULL,
|
||||
}
|
||||
};
|
||||
heads[3].val = &keyval[0];
|
||||
heads[2].val = &keyval[0];
|
||||
|
||||
/* 16 bytes random */
|
||||
result = Curl_rand(data, (unsigned char *)rand, sizeof(rand));
|
||||
|
|
@ -1065,6 +1060,7 @@ CURLcode Curl_ws_request(struct Curl_easy *data, struct dynbuf *req)
|
|||
heads[i].val);
|
||||
}
|
||||
}
|
||||
data->state.http_hd_upgrade = TRUE;
|
||||
k->upgr101 = UPGR101_WS;
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue