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:
Stefan Eissing 2025-09-01 15:52:30 +02:00 committed by Daniel Stenberg
parent e00cb001c6
commit 4d040c71d7
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
25 changed files with 345 additions and 319 deletions

View file

@ -66,8 +66,8 @@ GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
Connection: TE
TE: gzip
Connection: TE
</protocol>
</verify>

View file

@ -176,8 +176,8 @@ GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
Connection: TE
TE: gzip
Connection: TE
</protocol>
</verify>

View file

@ -67,8 +67,8 @@ GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
Connection: TE
TE: gzip
Connection: TE
</protocol>
</verify>

View file

@ -66,8 +66,8 @@ GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
Connection: close, TE
TE: gzip
Connection: close, TE
</protocol>
</verify>

View file

@ -66,8 +66,8 @@ GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
Connection: TE
TE: gzip
Connection: TE
</protocol>
</verify>

View file

@ -66,8 +66,8 @@ GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
Connection: TE
TE: gzip
Connection: TE
</protocol>
</verify>

View file

@ -183,9 +183,9 @@ GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
Connection: TE
TE: gzip
Accept-Encoding: xxx
Connection: TE
</protocol>
</verify>

View file

@ -52,8 +52,8 @@ GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
Connection: TE
TE: gzip
Connection: TE
</protocol>
<errorcode>

View file

@ -52,9 +52,9 @@ GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
Connection: Upgrade, HTTP2-Settings
Upgrade: h2c
HTTP2-Settings: AAMAAABkAAQAAQAAAAIAAAAA
Connection: Upgrade, HTTP2-Settings
</protocol>

View file

@ -47,9 +47,9 @@ GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
Connection: Upgrade, HTTP2-Settings
Upgrade: %H2CVER
HTTP2-Settings: AAMAAABkAAQAAQAAAAIAAAAA
Connection: Upgrade, HTTP2-Settings
</protocol>
</verify>

View file

@ -53,9 +53,9 @@ Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: NDMyMTUzMjE2MzIxNzMyMQ==
Connection: Upgrade
</protocol>
<errorcode>

View file

@ -58,9 +58,9 @@ Host: %HOSTIP:%HTTPPORT
User-Agent: webbie-sox/3
Accept: */*
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: NDMyMTUzMjE2MzIxNzMyMQ==
Connection: Upgrade
%hex[%8a%00]hex%
</protocol>

View file

@ -59,9 +59,9 @@ Host: %HOSTIP:%HTTPPORT
User-Agent: webbie-sox/3
Accept: */*
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: NDMyMTUzMjE2MzIxNzMyMQ==
Connection: Upgrade
%hex[%8a%808321]hex%
</protocol>

View file

@ -49,9 +49,9 @@ Host: %HOSTIP:%HTTPPORT
User-Agent: webbie-sox/3
Accept: */*
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: NDMyMTUzMjE2MzIxNzMyMQ==
Connection: Upgrade
</protocol>
# 22 == CURLE_HTTP_RETURNED_ERROR

View file

@ -58,9 +58,9 @@ Host: %HOSTIP:%HTTPPORT
User-Agent: websocket/%TESTNUMBER
Accept: */*
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: NDMyMTUzMjE2MzIxNzMyMQ==
Connection: Upgrade
</protocol>

View file

@ -43,8 +43,8 @@ GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
Connection: TE
TE: gzip
Connection: TE
</protocol>

View file

@ -51,8 +51,8 @@ GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
Connection: TE
TE: gzip
Connection: TE
</protocol>