header api: add curl_easy_header and curl_easy_nextheader

Add test 1940 to 1946 to verify.

Closes #8593
This commit is contained in:
Daniel Stenberg 2022-03-17 10:20:19 +01:00
parent bdc664a640
commit d1e4a67734
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
38 changed files with 1798 additions and 306 deletions

View file

@ -219,7 +219,8 @@ test1800 test1801 \
test1908 test1909 test1910 test1911 test1912 test1913 test1914 test1915 \
test1916 test1917 test1918 \
\
test1933 test1934 test1935 test1936 test1937 test1938 test1939 \
test1933 test1934 test1935 test1936 test1937 test1938 test1939 test1940 \
test1941 test1942 test1943 test1944 test1945 test1946 \
\
test2000 test2001 test2002 test2003 test2004 \
\

55
tests/data/test1940 Normal file
View file

@ -0,0 +1,55 @@
<testcase>
<info>
<keywords>
curl_easy_header
</keywords>
</info>
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test with trailing space
Content-Type: text/html
Content-Length: 0
Set-Cookie: onecookie=data;
Set-Cookie: secondcookie=2data;
Set-Cookie: cookie3=data3;
Location: /%TESTNUMBER0002
</data>
</reply>
# Client-side
<client>
<server>
http
</server>
<name>
curl_easy_header
</name>
<tool>
lib%TESTNUMBER
</tool>
<command>
http://%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<stdout>
Date == Thu, 09 Nov 2010 14:49:00 GMT
Server == test with trailing space
Content-Type == text/html
Content-Length == 0
Location == /%TESTNUMBER0002
- Set-Cookie == onecookie=data; (0/3)
- Set-Cookie == secondcookie=2data; (1/3)
- Set-Cookie == cookie3=data3; (2/3)
</stdout>
</verify>
</testcase>

75
tests/data/test1941 Normal file
View file

@ -0,0 +1,75 @@
<testcase>
<info>
<keywords>
curl_easy_header
CONNECT
</keywords>
</info>
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test with trailing space
Content-Type: text/html
Content-Length: 0
Set-Cookie: onecookie=data;
Set-Cookie: secondcookie=2data;
Set-Cookie: cookie3=data3;
Location: /%TESTNUMBER0002
</data>
<connect>
HTTP/1.1 200 Sure go ahead
Server: from the connect
Silly-thing: yes yes
</connect>
</reply>
# Client-side
<client>
<features>
proxy
SSL
</features>
<server>
http
http-proxy
</server>
<name>
curl_easy_header with CONNECT
</name>
<tool>
lib1940
</tool>
<command>
http://hello:%HTTPPORT/%TESTNUMBER %HOSTIP:%PROXYPORT
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<proxy>
CONNECT hello:%HTTPPORT HTTP/1.1
Host: hello:%HTTPPORT
Proxy-Connection: Keep-Alive
</proxy>
<stdout>
Date == Thu, 09 Nov 2010 14:49:00 GMT
Server == test with trailing space
Content-Type == text/html
Content-Length == 0
Location == /%TESTNUMBER0002
- Set-Cookie == onecookie=data; (0/3)
- Set-Cookie == secondcookie=2data; (1/3)
- Set-Cookie == cookie3=data3; (2/3)
Server == from the connect
Silly-thing == yes yes
</stdout>
</verify>
</testcase>

65
tests/data/test1942 Normal file
View file

@ -0,0 +1,65 @@
<testcase>
<info>
<keywords>
curl_easy_header
CONNECT
</keywords>
</info>
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.1 100 continue
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: maybe different
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test with trailing space
Content-Type: text/html
Content-Length: 0
Set-Cookie: onecookie=data;
Set-Cookie: secondcookie=2data;
Set-Cookie: cookie3=data3;
Location: /%TESTNUMBER0002
</data>
</reply>
# Client-side
<client>
<features>
http
</features>
<server>
http
</server>
<name>
curl_easy_header with 1xx response
</name>
<tool>
lib1940
</tool>
<command>
http://%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<stdout>
Date == Thu, 09 Nov 2010 14:49:00 GMT
Server == test with trailing space
Content-Type == text/html
Content-Length == 0
Location == /%TESTNUMBER0002
- Set-Cookie == onecookie=data; (0/3)
- Set-Cookie == secondcookie=2data; (1/3)
- Set-Cookie == cookie3=data3; (2/3)
Date == Thu, 09 Nov 2010 14:49:00 GMT
Server == maybe different
</stdout>
</verify>
</testcase>

61
tests/data/test1943 Normal file
View file

@ -0,0 +1,61 @@
<testcase>
<info>
<keywords>
curl_easy_header
CONNECT
</keywords>
</info>
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.1 200 funky chunky!
Server: fakeit/0.9 fakeitbad/1.0
Date: Thu, 09 Nov 2010 14:49:00 GMT
Transfer-Encoding: chunked
Trailer: server
Connection: mooo
40
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
30
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
21;heresatest=moooo
cccccccccccccccccccccccccccccccc
0
Server: sent-as-trailer
</data>
</reply>
# Client-side
<client>
<features>
http
</features>
<server>
http
</server>
<name>
curl_easy_header with trailers
</name>
<tool>
lib1940
</tool>
<command>
http://%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<stdout>
Date == Thu, 09 Nov 2010 14:49:00 GMT
Server == fakeit/0.9 fakeitbad/1.0
Server == sent-as-trailer
</stdout>
</verify>
</testcase>

63
tests/data/test1944 Normal file
View file

@ -0,0 +1,63 @@
<testcase>
<info>
<keywords>
curl_easy_header
</keywords>
</info>
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.1 302 OK
Date: Thu, 01 Nov 2001 14:49:00 GMT
Server: test with trailing space
Content-Type: text/html
Content-Length: 0
Set-Cookie: onecookie=data;
Set-Cookie: secondcookie=2data;
Set-Cookie: cookie3=data3;
Location: /%TESTNUMBER0002
</data>
<data2 nocheck="yes">
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: the other one
Content-Type: text/html
Content-Length: 0
Set-Cookie: 1cookie=data1;
Set-Cookie: 2cookie=data2;
</data>
</reply>
# Client-side
<client>
<server>
http
</server>
<name>
curl_easy_header with redirect
</name>
<tool>
lib1940
</tool>
<command>
http://%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<stdout>
Date == Thu, 09 Nov 2010 14:49:00 GMT
Server == the other one
Content-Type == text/html
Content-Length == 0
- Set-Cookie == 1cookie=data1; (0/2)
- Set-Cookie == 2cookie=data2; (1/2)
</stdout>
</verify>
</testcase>

75
tests/data/test1945 Normal file
View file

@ -0,0 +1,75 @@
<testcase>
<info>
<keywords>
curl_easy_header
CONNECT
</keywords>
</info>
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test with trailing space
Content-Type: text/html
Content-Length: 0
Set-Cookie: onecookie=data;
Set-Cookie: secondcookie=2data;
Set-Cookie: cookie3=data3;
Location: /%TESTNUMBER0002
</data>
<connect>
HTTP/1.1 200 Sure go ahead
Server: from the connect
Silly-thing: yes yes
</connect>
</reply>
# Client-side
<client>
<features>
proxy
SSL
</features>
<server>
http
http-proxy
</server>
<name>
curl_easy_nextheader with server + CONNECT
</name>
<tool>
lib%TESTNUMBER
</tool>
<command>
http://hello:%HTTPPORT/%TESTNUMBER %HOSTIP:%PROXYPORT
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<proxy>
CONNECT hello:%HTTPPORT HTTP/1.1
Host: hello:%HTTPPORT
Proxy-Connection: Keep-Alive
</proxy>
<stdout>
Server == from the connect (0/2)
Silly-thing == yes yes (0/1)
Date == Thu, 09 Nov 2010 14:49:00 GMT (0/1)
Server == test with trailing space (1/2)
Content-Type == text/html (0/1)
Content-Length == 0 (0/1)
Set-Cookie == onecookie=data; (0/3)
Set-Cookie == secondcookie=2data; (1/3)
Set-Cookie == cookie3=data3; (2/3)
Location == /19450002 (0/1)
</stdout>
</verify>
</testcase>

65
tests/data/test1946 Normal file
View file

@ -0,0 +1,65 @@
<testcase>
<info>
<keywords>
curl_easy_header
</keywords>
</info>
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.1 302 OK
Date: Thu, 01 Nov 2001 14:49:00 GMT
Server: test with trailing space
Content-Type: text/html
Content-Length: 0
Set-Cookie: onecookie=data;
Set-Cookie: secondcookie=2data;
Set-Cookie: cookie3=data3;
Location: /%TESTNUMBER0002
</data>
<data2 nocheck="yes">
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: the other one
Content-Type: text/html
Content-Length: 0
Set-Cookie: 1cookie=data1;
Set-Cookie: 2cookie=data2;
</data>
</reply>
# Client-side
<client>
<server>
http
</server>
<name>
curl_easy_header with redirect but get headers from first request
</name>
<tool>
lib%TESTNUMBER
</tool>
<command>
http://%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<stdout>
Date == Thu, 01 Nov 2001 14:49:00 GMT
Server == test with trailing space
Content-Type == text/html
Content-Length == 0
Location == /19460002
- Set-Cookie == onecookie=data; (0/3)
- Set-Cookie == secondcookie=2data; (1/3)
- Set-Cookie == cookie3=data3; (2/3)
</stdout>
</verify>
</testcase>