diff options
author | ng0 <ng0@n0.is> | 2019-09-12 15:09:29 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-09-12 15:09:29 +0000 |
commit | 5d5a61dc56228532927a7786375a13d7ae749180 (patch) | |
tree | 1b4b73a0016f005655aaa18982df8383f790527f /tests | |
parent | bc555b4f37422efffcc9969f645f9dbf3cb444bd (diff) | |
parent | 9cd755e1d768bbf228e7c9faf223b7459f7e0105 (diff) | |
download | gnurl-5d5a61dc56228532927a7786375a13d7ae749180.tar.gz gnurl-5d5a61dc56228532927a7786375a13d7ae749180.tar.bz2 gnurl-5d5a61dc56228532927a7786375a13d7ae749180.zip |
Merge tag 'curl-7_66_0'
7.66.0
Diffstat (limited to 'tests')
46 files changed, 960 insertions, 90 deletions
diff --git a/tests/README b/tests/README index 16a8f06e1..bfd234a10 100644 --- a/tests/README +++ b/tests/README @@ -216,27 +216,12 @@ The curl Test Suite 2.1 Test case numbering - 1 - 99 HTTP - 100 - 199 FTP - 200 - 299 FILE - 300 - 399 HTTPS - 400 - 499 FTPS - 500 - 599 libcurl source code tests, not using the curl command tool - 600 - 699 SCP/SFTP - 700 - 799 SOCKS4 (even numbers) and SOCK5 (odd numbers) - 800 - 849 IMAP - 850 - 899 POP3 - 900 - 999 SMTP - 1000 - 1299 miscellaneous - 1300 - 1399 unit tests - 1400 - 1499 miscellaneous - 1500 - 1599 libcurl source code tests, not using the curl command tool - (same as 5xx) - 1600 - 1699 unit tests - 2000 - x multiple sequential protocols per test case - - There's nothing in the system that *requires* us to keep within these number - series. + Test cases used to be numbered by category, but the ranges filled + up. Subsets of tests can now be selected by passing keywords to the + runtests.pl script via the make TFLAGS variable. + + New tests should now be added by finding a free number in + tests/data/Makefile.inc. 3. Write tests diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc index dfedea3d8..e2a04e181 100644 --- a/tests/data/Makefile.inc +++ b/tests/data/Makefile.inc @@ -57,7 +57,7 @@ test298 test299 test300 test301 test302 test303 test304 test305 test306 \ test307 test308 test309 test310 test311 test312 test313 test314 test315 \ test316 test317 test318 test319 test320 test321 test322 test323 test324 \ test325 test326 test327 test328 test329 test330 test331 test332 test333 \ -test334 \ +test334 test335 \ test340 \ \ test350 test351 test352 test353 test354 test355 test356 \ @@ -93,20 +93,21 @@ test809 test810 test811 test812 test813 test814 test815 test816 test817 \ test818 test819 test820 test821 test822 test823 test824 test825 test826 \ test827 test828 test829 test830 test831 test832 test833 test834 test835 \ test836 test837 test838 test839 test840 test841 test842 test843 test844 \ -test845 test846 test847 \ +test845 test846 test847 test848 test849 \ \ test850 test851 test852 test853 test854 test855 test856 test857 test858 \ test859 test860 test861 test862 test863 test864 test865 test866 test867 \ test868 test869 test870 test871 test872 test873 test874 test875 test876 \ test877 test878 test879 test880 test881 test882 test883 test884 test885 \ -test886 test887 test888 test889 test890 test891 \ +test886 test887 test888 test889 test890 test891 test892 test893 \ \ test900 test901 test902 test903 test904 test905 test906 test907 test908 \ test909 test910 test911 test912 test913 test914 test915 test916 test917 \ test918 test919 test920 test921 test922 test923 test924 test925 test926 \ test927 test928 test929 test930 test931 test932 test933 test934 test935 \ test936 test937 test938 test939 test940 test941 test942 test943 test944 \ -test945 test946 test947 test948 test949 test950 test951 test952 \ +test945 test946 test947 test948 test949 test950 test951 test952 test953 \ +test954 \ \ test1000 test1001 test1002 test1003 test1004 test1005 test1006 test1007 \ test1008 test1009 test1010 test1011 test1012 test1013 test1014 test1015 \ @@ -129,7 +130,7 @@ test1136 test1137 test1138 test1141 test1142 test1143 \ test1144 test1145 test1146 test1147 test1148 test1149 test1150 test1151 \ test1152 test1153 test1154 test1155 test1156 test1157 test1158 test1159 \ test1160 test1161 test1162 test1163 test1164 test1165 \ -test1170 test1171 test1172 \ +test1170 test1171 test1172 test1174 \ \ test1200 test1201 test1202 test1203 test1204 test1205 test1206 test1207 \ test1208 test1209 test1210 test1211 test1212 test1213 test1214 test1215 \ @@ -140,7 +141,7 @@ test1236 test1237 test1238 test1239 test1240 test1241 test1242 test1243 \ test1244 test1245 test1246 test1247 test1248 test1249 test1250 test1251 \ test1252 test1253 test1254 test1255 test1256 test1257 test1258 test1259 \ test1260 test1261 test1262 test1263 test1264 test1265 test1266 test1267 \ -test1268 \ +test1268 test1269 \ \ test1280 test1281 test1282 test1283 test1284 test1285 test1286 test1287 \ test1288 test1289 test1290 test1291 test1292 \ @@ -177,7 +178,7 @@ test1540 test1541 \ test1550 test1551 test1552 test1553 test1554 test1555 test1556 test1557 \ test1558 test1559 test1560 test1561 test1562 test1563 \ \ -test1590 test1591 test1592 test1593 \ +test1590 test1591 test1592 test1593 test1594 \ \ test1600 test1601 test1602 test1603 test1604 test1605 test1606 test1607 \ test1608 test1609 test1620 test1621 \ @@ -199,7 +200,8 @@ test2040 test2041 test2042 test2043 test2044 test2045 test2046 test2047 \ test2048 test2049 test2050 test2051 test2052 test2053 test2054 test2055 \ test2056 test2057 test2058 test2059 test2060 test2061 test2062 test2063 \ test2064 test2065 test2066 test2067 test2068 test2069 \ - test2071 test2072 test2073 test2074 test2075 test2076 \ + test2071 test2072 test2073 test2074 test2075 test2076 test2077 \ +test2078 \ test2080 \ test2100 \ \ diff --git a/tests/data/test1002 b/tests/data/test1002 index d12046e5e..c20995d90 100644 --- a/tests/data/test1002 +++ b/tests/data/test1002 @@ -103,6 +103,14 @@ Expect: 100-continue st GET http://%HOSTIP:%HTTPPORT/1002.upload2 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
+Content-Range: bytes 2-4/5
+User-Agent: curl/7.16.1
+Accept: */*
+Proxy-Connection: Keep-Alive
+Content-Length: 0
+
+GET http://%HOSTIP:%HTTPPORT/1002.upload2 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
Authorization: Digest username="auser", realm="testrealm", nonce="1053604144", uri="/1002.upload2", response="d711f0d2042786d930de635ba0d1a1d0"
Content-Range: bytes 2-4/5
User-Agent: curl/7.16.1
diff --git a/tests/data/test1135 b/tests/data/test1135 index 3591a543b..eca6860fb 100644 --- a/tests/data/test1135 +++ b/tests/data/test1135 @@ -91,6 +91,7 @@ CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle, CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle, CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle, CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle, +CURL_EXTERN CURLMcode curl_multi_poll(CURLM *multi_handle, CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle, CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle); CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle, diff --git a/tests/data/test1174 b/tests/data/test1174 new file mode 100644 index 000000000..b316fde8c --- /dev/null +++ b/tests/data/test1174 @@ -0,0 +1,50 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP/0.9 +</keywords> +</info> + +# +# Server-side +<reply> +<data> +-foo- swsclose +</data> +<datacheck> +</datacheck> +</reply> + +# +# Client-side +<client> +<server> +http +</server> + <name> +HTTP/0.9 GET response denied by default + </name> + <command> +http://%HOSTIP:%HTTPPORT/1174 +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<strip> +^User-Agent:.* +</strip> +<protocol> +GET /1174 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+
+</protocol> +# unsupported protocol +<errorcode> +1 +</errorcode> +</verify> +</testcase> diff --git a/tests/data/test1269 b/tests/data/test1269 new file mode 100644 index 000000000..c77663633 --- /dev/null +++ b/tests/data/test1269 @@ -0,0 +1,34 @@ +<testcase> +<info> +<keywords> +--retry-delay +</keywords> +</info> + +# +# Server-side +<reply> +</reply> + +# +# Client-side +<client> +<server> +none +</server> + <name> +too large --retry-delay value + </name> + <command> +--retry 3 --retry-delay 9223372036854776 http://%HOSTIP:%HTTPPORT/1269 +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<errorcode> +2 +</errorcode> +</verify> +</testcase> diff --git a/tests/data/test1291 b/tests/data/test1291 index 3f1575184..a2e505fc9 100644 --- a/tests/data/test1291 +++ b/tests/data/test1291 @@ -21,7 +21,7 @@ HTTP PUT none </server> <name> -Attempt to upload 100K files but fail immediately +Attempt to upload 1000 files but fail immediately </name> <command> -K log/cmd1291 --fail-early @@ -31,7 +31,7 @@ XXXXXXXx </file> # generate the config file <precheck> -perl -e 'for(1 .. 100000) { printf("upload-file=log/upload-this\nurl=htttttp://non-existing-host.haxx.se/upload/1291\n", $_);}' > log/cmd1291; +perl -e 'for(1 .. 1000) { printf("upload-file=log/upload-this\nurl=htttttp://non-existing-host.haxx.se/upload/1291\n", $_);}' > log/cmd1291; </precheck> </client> @@ -40,11 +40,5 @@ perl -e 'for(1 .. 100000) { printf("upload-file=log/upload-this\nurl=htttttp://n <errorcode> 1 </errorcode> - -# we disable valgrind here since it takes 40+ seconds even on a fairly snappy -# machine -<valgrind> -disable -</valgrind> </verify> </testcase> diff --git a/tests/data/test1401 b/tests/data/test1401 index 2cb43b7ee..c414c4751 100644 --- a/tests/data/test1401 +++ b/tests/data/test1401 @@ -88,7 +88,6 @@ int main(int argc, char *argv[]) curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, slist1); curl_easy_setopt(hnd, CURLOPT_USERAGENT, "MyUA"); curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L); - curl_easy_setopt(hnd, CURLOPT_HTTP09_ALLOWED, 1L); curl_easy_setopt(hnd, CURLOPT_COOKIE, "chocolate=chip"); curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); diff --git a/tests/data/test1402 b/tests/data/test1402 index a806a16ff..56861a4ba 100644 --- a/tests/data/test1402 +++ b/tests/data/test1402 @@ -80,7 +80,6 @@ int main(int argc, char *argv[]) curl_easy_setopt(hnd, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)16); curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped"); curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L); - curl_easy_setopt(hnd, CURLOPT_HTTP09_ALLOWED, 1L); curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); diff --git a/tests/data/test1403 b/tests/data/test1403 index b73d93004..4237c07c8 100644 --- a/tests/data/test1403 +++ b/tests/data/test1403 @@ -75,7 +75,6 @@ int main(int argc, char *argv[]) curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/1403?foo=bar&baz=quux"); curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped"); curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L); - curl_easy_setopt(hnd, CURLOPT_HTTP09_ALLOWED, 1L); curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); diff --git a/tests/data/test1404 b/tests/data/test1404 index 6a83e0043..35e1ee91b 100644 --- a/tests/data/test1404 +++ b/tests/data/test1404 @@ -146,7 +146,6 @@ int main(int argc, char *argv[]) curl_easy_setopt(hnd, CURLOPT_MIMEPOST, mime1); curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped"); curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L); - curl_easy_setopt(hnd, CURLOPT_HTTP09_ALLOWED, 1L); curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); diff --git a/tests/data/test1406 b/tests/data/test1406 index fb134b1f3..dc8247dfa 100644 --- a/tests/data/test1406 +++ b/tests/data/test1406 @@ -76,13 +76,13 @@ int main(int argc, char *argv[]) hnd = curl_easy_init(); curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); - curl_easy_setopt(hnd, CURLOPT_INFILESIZE_LARGE, (curl_off_t)38); curl_easy_setopt(hnd, CURLOPT_URL, "smtp://%HOSTIP:%SMTPPORT/1406"); curl_easy_setopt(hnd, CURLOPT_UPLOAD, 1L); curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); curl_easy_setopt(hnd, CURLOPT_MAIL_FROM, "sender@example.com"); curl_easy_setopt(hnd, CURLOPT_MAIL_RCPT, slist1); + curl_easy_setopt(hnd, CURLOPT_INFILESIZE_LARGE, (curl_off_t)38); /* Here is a list of options the curl code used that cannot get generated as source easily. You may select to either not use them or implement diff --git a/tests/data/test1412 b/tests/data/test1412 index ae63290e9..36d3d1d93 100644 --- a/tests/data/test1412 +++ b/tests/data/test1412 @@ -25,6 +25,19 @@ Connection: close This is not the real page </data> +# The second URL will get this response +<data1> +HTTP/1.1 401 Authorization Required swsclose
+Server: Apache/1.3.27 (Darwin) PHP/4.1.2
+WWW-Authenticate: Blackmagic realm="gimme all yer s3cr3ts"
+WWW-Authenticate: Basic realm="gimme all yer s3cr3ts"
+WWW-Authenticate: Digest realm="gimme all yer s3cr3ts", nonce="11223344"
+Content-Type: text/html; charset=iso-8859-1
+Connection: close
+
+This is not the real page +</data1> + # This is supposed to be returned when the server gets a # Authorization: Digest line passed-in from the client <data1000> @@ -109,6 +122,11 @@ Accept: */* GET /14120001 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/7.10.5 (i686-pc-linux-gnu) libcurl/7.10.5 OpenSSL/0.9.7a ipv6 zlib/1.1.3
+Accept: */*
+
+GET /14120001 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
Authorization: Digest username="testuser", realm="gimme all yer s3cr3ts", nonce="11223344", uri="/14120001", response="0085df91870374c8bf4e94415e7fbf8e"
User-Agent: curl/7.10.5 (i686-pc-linux-gnu) libcurl/7.10.5 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Accept: */*
diff --git a/tests/data/test1418 b/tests/data/test1418 index b3a2f23b2..c137b1c59 100644 --- a/tests/data/test1418 +++ b/tests/data/test1418 @@ -22,6 +22,15 @@ WWW-Authenticate: Basic Please auth with me </data> +<data3> +HTTP/1.1 401 Authentication please!
+Content-Length: 20
+WWW-Authenticate: Digest realm="loonie", nonce="314156592"
+WWW-Authenticate: Basic
+
+Please auth with me +</data3> + # This is supposed to be returned when the server gets the second # Authorization: NTLM line passed-in from the client <data1000> @@ -99,6 +108,10 @@ Accept: */* GET /14180003 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
+Accept: */*
+
+GET /14180003 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
Authorization: Digest username="testuser", realm="loonie", nonce="314156592", uri="/14180003", response="1c6390a67bac3283a9b023402f3b3540"
Accept: */*
diff --git a/tests/data/test1420 b/tests/data/test1420 index b47510511..99d50c35b 100644 --- a/tests/data/test1420 +++ b/tests/data/test1420 @@ -66,7 +66,6 @@ int main(int argc, char *argv[]) curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); curl_easy_setopt(hnd, CURLOPT_URL, "imap://%HOSTIP:%IMAPPORT/1420/;MAILINDEX=1"); curl_easy_setopt(hnd, CURLOPT_USERPWD, "user:secret"); - curl_easy_setopt(hnd, CURLOPT_HTTP09_ALLOWED, 1L); curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); diff --git a/tests/data/test1514 b/tests/data/test1514 index 38f5da61f..6c09ae3b0 100644 --- a/tests/data/test1514 +++ b/tests/data/test1514 @@ -4,13 +4,14 @@ HTTP HTTP POST Content-Length +chunked Transfer-Encoding </keywords> </info> # Server-side <reply> <data nocheck="yes"> -HTTP/1.1 411 Length Required
+HTTP/1.1 200 OK
Date: Sun, 19 Jan 2014 18:50:58 GMT
Server: test-server/fake swsclose
Connection: close
@@ -36,13 +37,27 @@ http://%HOSTIP:%HTTPPORT/1514 # Verify data after the test has been "shot" <verify> # Content-Length header is not present +# Transfer-Encoding header is added automatically <protocol> POST /1514 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
+Transfer-Encoding: chunked
Content-Type: application/x-www-form-urlencoded
Expect: 100-continue
+1
+d
+1
+u
+1
+m
+1
+m
+1
+y
+0
+
</protocol> </verify> </testcase> diff --git a/tests/data/test153 b/tests/data/test153 index f679de4ea..77f7adb01 100644 --- a/tests/data/test153 +++ b/tests/data/test153 @@ -9,7 +9,7 @@ HTTP Digest auth # Server-side <reply> -# reply back and ask for Digest auth +# First reply back and ask for Digest auth <data1> HTTP/1.1 401 Authorization Required swsclose
Server: Apache/1.3.27 (Darwin) PHP/4.1.2
@@ -20,6 +20,17 @@ Content-Length: 26 This is not the real page </data1> +# second reply back +<data2> +HTTP/1.1 401 Authorization Required swsclose
+Server: Apache/1.3.27 (Darwin) PHP/4.1.2
+WWW-Authenticate: Digest realm="testrealm", nonce="1053604145"
+Content-Type: text/html; charset=iso-8859-1
+Content-Length: 26
+
+This is not the real page +</data2> + # This is supposed to be returned when the server gets a # Authorization: Digest line passed-in from the client <data1001> @@ -93,6 +104,11 @@ Accept: */* GET /1530002 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/7.11.0-CVS (i686-pc-linux-gnu) libcurl/7.11.0-CVS OpenSSL/0.9.6b ipv6 zlib/1.1.4 GSS
+Accept: */*
+
+GET /1530002 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
Authorization: Digest username="testuser", realm="testrealm", nonce="1053604145", uri="/1530002", response="f84511b014fdd0ba6494f42871079c32"
User-Agent: curl/7.11.0-CVS (i686-pc-linux-gnu) libcurl/7.11.0-CVS OpenSSL/0.9.6b ipv6 zlib/1.1.4 GSS
Accept: */*
@@ -117,6 +133,12 @@ Content-Type: text/html; charset=iso-8859-1 Content-Length: 23
This IS the real page! +HTTP/1.1 401 Authorization Required swsclose
+Server: Apache/1.3.27 (Darwin) PHP/4.1.2
+WWW-Authenticate: Digest realm="testrealm", nonce="1053604145"
+Content-Type: text/html; charset=iso-8859-1
+Content-Length: 26
+
HTTP/1.1 401 Authorization re-negotiation please swsbounce
Server: Apache/1.3.27 (Darwin) PHP/4.1.2
WWW-Authenticate: Digest realm="testrealm", algorithm=MD5, nonce="999999", stale=true, qop="auth"
diff --git a/tests/data/test1538 b/tests/data/test1538 index 98d6731e9..9374debb7 100644 --- a/tests/data/test1538 +++ b/tests/data/test1538 @@ -126,7 +126,8 @@ e90: SSL public key does not match pinned public key e91: SSL server certificate status verification FAILED e92: Stream error in the HTTP/2 framing layer e93: API function called from within callback -e94: Unknown error +e94: An authentication function returned an error +e95: Unknown error m-1: Please call curl_multi_perform() soon m0: No error m1: Invalid multi handle diff --git a/tests/data/test1594 b/tests/data/test1594 new file mode 100644 index 000000000..4907ca2be --- /dev/null +++ b/tests/data/test1594 @@ -0,0 +1,52 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +HTTP replaced headers +CURLOPT_TIMECONDITION +If-Modified-Since +</keywords> +</info> + +# Server-side +<reply> +<data nocheck="yes"> +HTTP/1.1 503 Error +Date: Thu, 11 Jul 2019 02:26:59 GMT +Server: test-server/swsclose +Retry-After: 22 + +</data> +</reply> +# Client-side +<client> +<server> +http +</server> +<name> +HTTP Retry-After header parsing and extraction +</name> +<tool> +lib1594 +</tool> +<command> +http://%HOSTIP:%HTTPPORT/1594 +</command> +</client> + +<verify> +<strip> +^User-Agent:.* +</strip> +<protocol> +GET /1594 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+
+</protocol> +<stdout> +Retry-After: 22 +</stdout> +</verify> +</testcase> diff --git a/tests/data/test1595 b/tests/data/test1595 new file mode 100644 index 000000000..29b2b865f --- /dev/null +++ b/tests/data/test1595 @@ -0,0 +1,51 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +HTTP replaced headers +CURLOPT_TIMECONDITION +If-Modified-Since +</keywords> +</info> + +# Server-side +<reply> +<data nocheck="yes"> +HTTP/1.1 503 Error +Date: Thu, 11 Jul 2019 02:26:59 GMT +Server: test-server/swsclose + +</data> +</reply> +# Client-side +<client> +<server> +http +</server> +<name> +HTTP Retry-After header extraction (without header) +</name> +<tool> +lib1594 +</tool> +<command> +http://%HOSTIP:%HTTPPORT/1595 +</command> +</client> + +<verify> +<strip> +^User-Agent:.* +</strip> +<protocol> +GET /1595 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+
+</protocol> +<stdout> +Retry-After: 0 +</stdout> +</verify> +</testcase> diff --git a/tests/data/test1596 b/tests/data/test1596 new file mode 100644 index 000000000..9a8cb480e --- /dev/null +++ b/tests/data/test1596 @@ -0,0 +1,52 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +HTTP replaced headers +CURLOPT_TIMECONDITION +If-Modified-Since +</keywords> +</info> + +# Server-side +<reply> +<data nocheck="yes"> +HTTP/1.1 503 Error +Date: Thu, 11 Jul 2019 02:26:59 GMT +Server: test-server/swsclose +Retry-After: Thu, 11 Jul 2024 02:26:59 GMT + +</data> +</reply> +# Client-side +<client> +<server> +http +</server> +<name> +HTTP Retry-After header parsing using a date +</name> +<tool> +lib1596 +</tool> +<command> +http://%HOSTIP:%HTTPPORT/1596 +</command> +</client> + +<verify> +<strip> +^User-Agent:.* +</strip> +<protocol> +GET /1596 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+
+</protocol> +<stdout> +Retry-After: 172066 +</stdout> +</verify> +</testcase> diff --git a/tests/data/test1654 b/tests/data/test1654 index 175076c8a..5b32cb419 100644 --- a/tests/data/test1654 +++ b/tests/data/test1654 @@ -32,7 +32,7 @@ unit1654 <file name="log/1654" mode="text"> h2 example.com 443 h3 shiny.example.com 8443 "20191231 00:00:00" 0 1 # a comment -h2c example.com 443 h3 shiny.example.com 8443 "20291231 23:30:00" 0 1 +h2 foo.example.com 443 h3 shiny.example.com 8443 "20291231 23:30:00" 0 1 h1 example.com 443 h3 shiny.example.com 8443 "20121231 00:00:01" 0 1 h3 example.com 443 h3 shiny.example.com 8443 "20131231 00:00:00" 0 1 # also a comment @@ -45,14 +45,14 @@ rubbish # Your alt-svc cache. https://curl.haxx.se/docs/alt-svc.html # This file was generated by libcurl! Edit at your own risk. h2 example.com 443 h3 shiny.example.com 8443 "20191231 00:00:00" 0 1 -h2c example.com 443 h3 shiny.example.com 8443 "20291231 23:30:00" 0 1 +h2 foo.example.com 443 h3 shiny.example.com 8443 "20291231 23:30:00" 0 1 h1 example.com 443 h3 shiny.example.com 8443 "20121231 00:00:01" 0 1 h3 example.com 443 h3 shiny.example.com 8443 "20131231 00:00:00" 0 1 h1 example.org 8080 h2 example.com 8080 "20190125 22:34:21" 0 0 h1 2.example.org 8080 h3 2.example.org 8080 "20190125 22:34:21" 0 0 h1 3.example.org 8080 h2 example.com 8080 "20190125 22:34:21" 0 0 h1 3.example.org 8080 h3 yesyes.com 8080 "20190125 22:34:21" 0 0 -h2c example.org 80 h2 example.com 443 "20190124 22:36:21" 0 0 +h2 example.org 80 h2 example.com 443 "20190124 22:36:21" 0 0 </file> </verify> </testcase> diff --git a/tests/data/test2006 b/tests/data/test2006 index 3acbdaee2..4d08e0aad 100644 --- a/tests/data/test2006 +++ b/tests/data/test2006 @@ -86,10 +86,6 @@ Accept: */* Some data delivered from an HTTP resource </file1> <file2 name="log/heads2006"> -Content-Length: 496
-Accept-ranges: bytes
- -
HTTP/1.1 200 OK Date: Thu, 21 Jun 2012 14:49:01 GMT Server: test-server/fake diff --git a/tests/data/test2007 b/tests/data/test2007 index b169c4906..bb4d5cde9 100644 --- a/tests/data/test2007 +++ b/tests/data/test2007 @@ -90,10 +90,6 @@ Something delivered from an HTTP resource s/Last-Modified:.*// </stripfile2> <file2 name="log/heads2007"> -Content-Length: 496
-Accept-ranges: bytes
- -
HTTP/1.1 200 OK Date: Thu, 21 Jun 2012 14:50:02 GMT Server: test-server/fake diff --git a/tests/data/test2008 b/tests/data/test2008 index 012f221c4..d6bbf6b4b 100644 --- a/tests/data/test2008 +++ b/tests/data/test2008 @@ -82,10 +82,6 @@ Some stuff delivered from an HTTP resource s/Last-Modified:.*// </stripfile2> <file2 name="log/heads2008"> -Content-Length: 496
-Accept-ranges: bytes
- -
HTTP/1.1 200 OK Date: Thu, 21 Jun 2012 15:23:48 GMT Server: test-server/fake diff --git a/tests/data/test2009 b/tests/data/test2009 index b0e5c6c66..1a9335851 100644 --- a/tests/data/test2009 +++ b/tests/data/test2009 @@ -83,10 +83,6 @@ Some contents delivered from an HTTP resource s/Last-Modified:.*// </stripfile2> <file2 name="log/heads2009"> -Content-Length: 496
-Accept-ranges: bytes
- -
HTTP/1.1 200 OK Date: Thu, 21 Jun 2012 16:27:17 GMT Server: test-server/fake diff --git a/tests/data/test2010 b/tests/data/test2010 index 33bb309eb..1f5320fe9 100644 --- a/tests/data/test2010 +++ b/tests/data/test2010 @@ -82,10 +82,6 @@ Contents delivered from an HTTP resource s/Last-Modified:.*// </stripfile2> <file2 name="log/heads2010"> -Content-Length: 496
-Accept-ranges: bytes
- -
HTTP/1.1 200 OK Date: Thu, 21 Jun 2012 17:37:27 GMT Server: test-server/fake diff --git a/tests/data/test2047 b/tests/data/test2047 index fc140486b..bc7350971 100644 --- a/tests/data/test2047 +++ b/tests/data/test2047 @@ -92,7 +92,7 @@ OK 1 1 3 -http://xn--4cab6c.se/20470001 +http://åäö.se/20470001 text/plain; charset=us-ascii 200 </stdout> diff --git a/tests/data/test2077 b/tests/data/test2077 new file mode 100644 index 000000000..0c600f5c3 --- /dev/null +++ b/tests/data/test2077 @@ -0,0 +1,42 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +GSS-API +</keywords> +</info> + +# Server-side +<reply> +<data> +HTTP/1.1 200 OK swsclose
+Content-Length: 23
+
+This IS the real page! +</data> +</reply> + +# Client-side +<client> +<server> +http +</server> +<features> +GSS-API +</features> +<name> +curl --fail --negotiate to unauthenticated service fails +</name> +<command> +http://%HOSTIP:%HTTPPORT/2077 -u : --fail --negotiate +</command> +</client> + +# Verify data after the test has been "shot" +<verify> +<errorcode> +0 +</errorcode> +</verify> +</testcase> diff --git a/tests/data/test2078 b/tests/data/test2078 new file mode 100644 index 000000000..99bc2dbee --- /dev/null +++ b/tests/data/test2078 @@ -0,0 +1,54 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +GSS-API +</keywords> +</info> + +# Server-side +<reply> +<data> +HTTP/1.1 200 OK swsclose
+Content-Length: 23
+
+This IS the real page! +</data> +</reply> + +# Client-side +<client> +<server> +http +</server> +<features> +GSS-API +</features> +<name> +curl --negotiate should not send empty POST request only +</name> +<command> +http://%HOSTIP:%HTTPPORT/2078 -u : --negotiate --data name=value +</command> +</client> + +# Verify data after the test has been "shot" +<verify> +<errorcode> +0 +</errorcode> +<strip> +^User-Agent:.* +</strip> +<protocol nonewline="yes"> +POST /2078 HTTP/1.1
+Host: 127.0.0.1:8990
+Accept: */*
+Content-Length: 10
+Content-Type: application/x-www-form-urlencoded
+
+name=value +</protocol> +</verify> +</testcase> diff --git a/tests/data/test335 b/tests/data/test335 new file mode 100644 index 000000000..4d54da980 --- /dev/null +++ b/tests/data/test335 @@ -0,0 +1,102 @@ +# Mostly a duplicate of test168 +<testcase> +<info> +<keywords> +HTTP +HTTP GET +HTTP proxy +HTTP proxy Digest auth +HTTP Digest auth +HTTP auth in URL +</keywords> +</info> + +# Server-side +<reply> + +# this is returned first since we get no proxy-auth +<data> +HTTP/1.1 407 Authorization Required to proxy me my dear swsclose +Proxy-Authenticate: Digest realm="weirdorealm", nonce="12345" + +And you should ignore this data. +</data> + +# then this is returned since we get no server-auth +<data1000> +HTTP/1.1 401 Authorization to the remote host as well swsbounce swsclose +WWW-Authenticate: Digest realm="realmweirdo", nonce="123456" + +you should ignore this data too +</data1000> + +<data1001> +HTTP/1.1 200 OK swsclose +Server: no +Content-Length: 15 + +Nice auth sir! +</data1001> + +<datacheck> +HTTP/1.1 407 Authorization Required to proxy me my dear swsclose +Proxy-Authenticate: Digest realm="weirdorealm", nonce="12345" + +HTTP/1.1 401 Authorization to the remote host as well swsbounce swsclose +WWW-Authenticate: Digest realm="realmweirdo", nonce="123456" + +HTTP/1.1 200 OK swsclose +Server: no +Content-Length: 15 + +Nice auth sir! +</datacheck> +</reply> + +# Client-side +<client> +<server> +http +</server> +<features> +!SSPI +crypto +</features> + <name> +HTTP with proxy Digest and site Digest with creds in URLs + </name> + <command> +http://digest:alot@data.from.server.requiring.digest.hohoho.com/335 --proxy http://foo:bar@%HOSTIP:%HTTPPORT --proxy-digest --digest +</command> +</client> + +# Verify data after the test has been "shot" +<verify> +<strip> +^User-Agent: curl/.* +</strip> +<protocol> +GET http://data.from.server.requiring.digest.hohoho.com/335 HTTP/1.1
+Host: data.from.server.requiring.digest.hohoho.com
+User-Agent: curl/7.12.0-CVS (i686-pc-linux-gnu) libcurl/7.12.0-CVS OpenSSL/0.9.6b zlib/1.1.4 c-ares/1.2.0 libidn/0.4.3
+Accept: */*
+Proxy-Connection: Keep-Alive
+
+GET http://data.from.server.requiring.digest.hohoho.com/335 HTTP/1.1
+Host: data.from.server.requiring.digest.hohoho.com
+Proxy-Authorization: Digest username="foo", realm="weirdorealm", nonce="12345", uri="/335", response="f61609cd8f5bb205ef4e169b2c5626cb"
+User-Agent: curl/7.12.0-CVS (i686-pc-linux-gnu) libcurl/7.12.0-CVS OpenSSL/0.9.6b zlib/1.1.4 c-ares/1.2.0 libidn/0.4.3
+Accept: */*
+Proxy-Connection: Keep-Alive
+
+GET http://data.from.server.requiring.digest.hohoho.com/335 HTTP/1.1
+Host: data.from.server.requiring.digest.hohoho.com
+Proxy-Authorization: Digest username="foo", realm="weirdorealm", nonce="12345", uri="/335", response="f61609cd8f5bb205ef4e169b2c5626cb"
+Authorization: Digest username="digest", realm="realmweirdo", nonce="123456", uri="/335", response="08a2e2e684047f4219a38ddc189ac00c"
+User-Agent: curl/7.12.0-CVS (i686-pc-linux-gnu) libcurl/7.12.0-CVS OpenSSL/0.9.6b ipv6 zlib/1.1.4 GSS libidn/0.4.3
+Accept: */*
+Proxy-Connection: Keep-Alive
+
+</protocol> +</verify> +</testcase> diff --git a/tests/data/test356 b/tests/data/test356 index e2ac4860d..1be05fe6f 100644 --- a/tests/data/test356 +++ b/tests/data/test356 @@ -16,7 +16,7 @@ Content-Length: 6 Connection: close Content-Type: text/html Funny-head: yesyes -Alt-Svc: h1="nowhere.foo:81" +Alt-Svc: h1="nowhere.foo:81", un-kno22!wn=":82" -foo- </data> diff --git a/tests/data/test848 b/tests/data/test848 new file mode 100644 index 000000000..2b4a30b2a --- /dev/null +++ b/tests/data/test848 @@ -0,0 +1,56 @@ +<testcase> +<info> +<keywords> +IMAP +SASL +SASL AUTH PLAIN +RFC4616 +</keywords> +</info> + +# +# Server-side +<reply> +<servercmd> +AUTH PLAIN +REPLY AUTHENTICATE + +REPLY c2hhcmVkLW1haWxib3gAdXNlcgBzZWNyZXQ= A002 OK AUTHENTICATE completed +</servercmd> +<data> +From: me@somewhere
+To: fake@nowhere
+
+body
+
+--
+ yours sincerely
+</data> +</reply> + +# +# Client-side +<client> +<server> +imap +</server> + <name> +IMAP plain authentication with alternative authorization identity + </name> + <command> +'imap://%HOSTIP:%IMAPPORT/848/;MAILINDEX=1' -u user:secret --sasl-authzid shared-mailbox +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<protocol> +A001 CAPABILITY
+A002 AUTHENTICATE PLAIN
+c2hhcmVkLW1haWxib3gAdXNlcgBzZWNyZXQ=
+A003 SELECT 848
+A004 FETCH 1 BODY[]
+A005 LOGOUT
+</protocol> +</verify> +</testcase> diff --git a/tests/data/test849 b/tests/data/test849 new file mode 100644 index 000000000..8a4b39c00 --- /dev/null +++ b/tests/data/test849 @@ -0,0 +1,51 @@ +<testcase> +<info> +<keywords> +IMAP +SASL +SASL AUTH PLAIN +RFC4616 +</keywords> +</info> + +# +# Server-side +<reply> +<servercmd> +AUTH PLAIN +REPLY AUTHENTICATE + +REPLY dXJzZWwAa3VydAB4aXBqM3BsbXE= A002 NO Not authorized +</servercmd> +</reply> + +# +# Client-side +<client> +<server> +imap +</server> + <name> +IMAP plain authentication with alternative authorization identity (Not authorized) + </name> + <command> +'imap://%HOSTIP:%IMAPPORT/849/;MAILINDEX=1' -u kurt:xipj3plmq --sasl-authzid ursel +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +# 67 - CURLE_LOGIN_DENIED +<errorcode> +67 +</errorcode> +# +# The multi interface considers a broken "CONNECT" as a prematurely broken +# transfer and such a connection will not get a "LOGOUT" +<protocol> +A001 CAPABILITY
+A002 AUTHENTICATE PLAIN
+dXJzZWwAa3VydAB4aXBqM3BsbXE=
+</protocol> +</verify> +</testcase> diff --git a/tests/data/test892 b/tests/data/test892 new file mode 100644 index 000000000..4b8318292 --- /dev/null +++ b/tests/data/test892 @@ -0,0 +1,57 @@ +<testcase> +<info> +<keywords> +POP3 +SASL +SASL AUTH PLAIN +RFC1734 +RFC4616 +RFC5034 +</keywords> +</info> + +# +# Server-side +<reply> +<servercmd> +AUTH PLAIN +REPLY AUTH + +REPLY c2hhcmVkLW1haWxib3gAdXNlcgBzZWNyZXQ= +OK Login successful +</servercmd> +<data> +From: me@somewhere
+To: fake@nowhere
+
+body
+
+--
+ yours sincerely
+</data> +</reply> + +# +# Client-side +<client> +<server> +pop3 +</server> + <name> +POP3 plain authentication with alternative authorization identity + </name> + <command> +pop3://%HOSTIP:%POP3PORT/892 -u user:secret --sasl-authzid shared-mailbox +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<protocol> +CAPA
+AUTH PLAIN
+c2hhcmVkLW1haWxib3gAdXNlcgBzZWNyZXQ=
+RETR 892
+QUIT
+</protocol> +</verify> +</testcase> diff --git a/tests/data/test893 b/tests/data/test893 new file mode 100644 index 000000000..2a762fc21 --- /dev/null +++ b/tests/data/test893 @@ -0,0 +1,53 @@ +<testcase> +<info> +<keywords> +POP3 +SASL +SASL AUTH PLAIN +RFC1734 +RFC4616 +RFC5034 +</keywords> +</info> + +# +# Server-side +<reply> +<servercmd> +AUTH PLAIN +REPLY AUTH + +REPLY dXJzZWwAa3VydAB4aXBqM3BsbXE= -ERR Not authorized +</servercmd> +</reply> + +# +# Client-side +<client> +<server> +pop3 +</server> + <name> +POP3 plain authentication with alternative authorization identity (Not authorized) + </name> + <command> +pop3://%HOSTIP:%POP3PORT/893 -u kurt:xipj3plmq --sasl-authzid ursel +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +# 67 - CURLE_LOGIN_DENIED +<errorcode> +67 +</errorcode> +# +# The multi interface considers a broken "CONNECT" as a prematurely broken +# transfer and such a connection will not get a "QUIT" +<protocol> +CAPA
+AUTH PLAIN
+dXJzZWwAa3VydAB4aXBqM3BsbXE=
+</protocol> +</verify> +</testcase> diff --git a/tests/data/test953 b/tests/data/test953 new file mode 100644 index 000000000..4a70e1f31 --- /dev/null +++ b/tests/data/test953 @@ -0,0 +1,56 @@ +<testcase> +<info> +<keywords> +SMTP +SASL +SASL AUTH PLAIN +RFC4616 +RFC4954 +</keywords> +</info> + +# +# Server-side +<reply> +<servercmd> +AUTH PLAIN +REPLY AUTH 334 PLAIN supported +REPLY dXJzZWwAa3VydAB4aXBqM3BsbXE= 235 Authenticated +</servercmd> +</reply> + +# +# Client-side +<client> +<server> +smtp +</server> + <name> +SMTP plain authentication with alternative authorization identity + </name> +<stdin> +mail body
+</stdin> + <command> +smtp://%HOSTIP:%SMTPPORT/953 --mail-rcpt recipient@example.com --mail-from sender@example.com -u kurt:xipj3plmq --sasl-authzid ursel -T - +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<protocol> +EHLO 953
+AUTH PLAIN
+dXJzZWwAa3VydAB4aXBqM3BsbXE=
+MAIL FROM:<sender@example.com>
+RCPT TO:<recipient@example.com>
+DATA
+QUIT
+</protocol> +<upload> +mail body
+.
+</upload> +</verify> +</testcase> diff --git a/tests/data/test954 b/tests/data/test954 new file mode 100644 index 000000000..a5e6bb0d3 --- /dev/null +++ b/tests/data/test954 @@ -0,0 +1,55 @@ +<testcase> +<info> +<keywords> +SMTP +SASL +SASL AUTH PLAIN +RFC4616 +RFC4954 +</keywords> +</info> + +# +# Server-side +<reply> +<servercmd> +AUTH PLAIN +REPLY AUTH 334 PLAIN supported +REPLY dXJzZWwAa3VydAB4aXBqM3BsbXE= 501 Not authorized +</servercmd> +</reply> + +# +# Client-side +<client> +<server> +smtp +</server> + <name> +SMTP plain authentication with alternative authorization identity (Not authorized) + </name> +<stdin> +mail body +</stdin> + <command> +smtp://%HOSTIP:%SMTPPORT/954 --mail-rcpt recipient@example.com --mail-from sender@example.com -u kurt:xipj3plmq --sasl-authzid ursel -T - +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +# 67 - CURLE_LOGIN_DENIED +<errorcode> +67 +</errorcode> +# +# The multi interface considers a broken "CONNECT" as a prematurely broken +# transfer and such a connection will not get a "QUIT" +<protocol> +EHLO 954
+AUTH PLAIN
+dXJzZWwAa3VydAB4aXBqM3BsbXE=
+</protocol> +</verify> +</testcase> diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc index f5effd97d..4ea9cf2a7 100644 --- a/tests/libtest/Makefile.inc +++ b/tests/libtest/Makefile.inc @@ -32,7 +32,7 @@ noinst_PROGRAMS = chkhostname libauthretry libntlmconnect \ lib1540 lib1541 \ lib1550 lib1551 lib1552 lib1553 lib1554 lib1555 lib1556 lib1557 \ lib1558 lib1559 lib1560 \ - lib1591 lib1592 lib1593 \ + lib1591 lib1592 lib1593 lib1594 lib1596 \ lib1900 lib1905 lib1906 \ lib2033 @@ -544,6 +544,13 @@ lib1592_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1592 lib1593_SOURCES = lib1593.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) lib1593_LDADD = $(TESTUTIL_LIBS) +lib1594_SOURCES = lib1594.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) +lib1594_LDADD = $(TESTUTIL_LIBS) + +lib1596_SOURCES = lib1594.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) +lib1596_LDADD = $(TESTUTIL_LIBS) +lib1596_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1596 + lib1900_SOURCES = lib1900.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) lib1900_LDADD = $(TESTUTIL_LIBS) lib1900_CPPFLAGS = $(AM_CPPFLAGS) diff --git a/tests/libtest/first.c b/tests/libtest/first.c index d687bf276..2731ef8db 100644 --- a/tests/libtest/first.c +++ b/tests/libtest/first.c @@ -97,9 +97,9 @@ static void memory_tracking_init(void) strcpy(fname, env); curl_free(env); curl_dbg_memdebug(fname); - /* this weird stuff here is to make curl_free() get called - before curl_memdebug() as otherwise memory tracking will - log a free() without an alloc! */ + /* this weird stuff here is to make curl_free() get called before + curl_dbg_memdebug() as otherwise memory tracking will log a free() + without an alloc! */ } /* if CURL_MEMLIMIT is set, this enables fail-on-alloc-number-N feature */ env = curl_getenv("CURL_MEMLIMIT"); diff --git a/tests/libtest/lib1560.c b/tests/libtest/lib1560.c index 1185096d8..85884474e 100644 --- a/tests/libtest/lib1560.c +++ b/tests/libtest/lib1560.c @@ -140,6 +140,10 @@ static struct testcase get_parts_list[] ={ "file | [11] | [12] | [13] | [14] | [15] | C:\\programs\\foo | [16] | [17]", CURLU_DEFAULT_SCHEME, 0, CURLUE_OK}, #endif + {"http://[ab.be:1]/x", "", + CURLU_DEFAULT_SCHEME, 0, CURLUE_MALFORMED_INPUT}, + {"http://[ab.be]/x", "", + CURLU_DEFAULT_SCHEME, 0, CURLUE_MALFORMED_INPUT}, /* URL without host name */ {"http://a:b@/x", "", CURLU_DEFAULT_SCHEME, 0, CURLUE_NO_HOST}, diff --git a/tests/libtest/lib1594.c b/tests/libtest/lib1594.c new file mode 100644 index 000000000..a76971590 --- /dev/null +++ b/tests/libtest/lib1594.c @@ -0,0 +1,66 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* Testing Retry-After header parser */ + +#include "test.h" + +#include "memdebug.h" + +int test(char *URL) +{ + struct curl_slist *header = NULL; + curl_off_t retry; + CURL *curl = NULL; + int res = 0; + + global_init(CURL_GLOBAL_ALL); + + easy_init(curl); + + easy_setopt(curl, CURLOPT_URL, URL); + + res = curl_easy_perform(curl); + if(res) + goto test_cleanup; + + res = curl_easy_getinfo(curl, CURLINFO_RETRY_AFTER, &retry); + if(res) + goto test_cleanup; + +#ifdef LIB1596 + /* we get a relative number of seconds, so add the number of seconds + we're at to make it a somewhat stable number. Then remove accuracy. */ + retry += time(NULL); + retry /= 10000; +#endif + printf("Retry-After: %" CURL_FORMAT_CURL_OFF_T "\n", retry); + +test_cleanup: + + /* always cleanup */ + curl_easy_cleanup(curl); + curl_slist_free_all(header); + curl_global_cleanup(); + + return res; +} diff --git a/tests/symbol-scan.pl b/tests/symbol-scan.pl index cfaffa792..c8d68147a 100755 --- a/tests/symbol-scan.pl +++ b/tests/symbol-scan.pl @@ -119,11 +119,13 @@ for my $e (sort @syms) { # CURL_EXTERN - is a define used for libcurl functions that are external, # public. No app or other code should ever use it. # + # CURLINC_ - defines for header dual-include prevention, ignore those. + # # *_LAST and *_LASTENTRY are just prefix for the placeholders used for the # last entry in many enum series. # - if($e =~ /(OBSOLETE|^CURL_EXTERN|_LAST\z|_LASTENTRY\z)/) { + if($e =~ /(OBSOLETE|^CURL_EXTERN|^CURLINC_|_LAST\z|_LASTENTRY\z)/) { $ignored++; next; } diff --git a/tests/unit/unit1607.c b/tests/unit/unit1607.c index 6e40be707..a8b0331ce 100644 --- a/tests/unit/unit1607.c +++ b/tests/unit/unit1607.c @@ -25,10 +25,6 @@ #include "connect.h" #include "share.h" -/* retrieves ip address and port from a sockaddr structure. - note it calls Curl_inet_ntop which sets errno on fail, not SOCKERRNO. */ -bool getaddressinfo(struct sockaddr *sa, char *addr, long *port); - #include "memdebug.h" /* LAST include file */ static void unit_stop(void) @@ -154,8 +150,8 @@ UNITTEST_START if(tests[i].address[j] == &skip) continue; - if(addr && !getaddressinfo(addr->ai_addr, - ipaddress, &port)) { + if(addr && !Curl_addr2string(addr->ai_addr, addr->ai_addrlen, + ipaddress, &port)) { fprintf(stderr, "%s:%d tests[%d] failed. getaddressinfo failed.\n", __FILE__, __LINE__, i); problem = true; diff --git a/tests/unit/unit1609.c b/tests/unit/unit1609.c index 8d9bc6526..8223a147c 100644 --- a/tests/unit/unit1609.c +++ b/tests/unit/unit1609.c @@ -25,10 +25,6 @@ #include "connect.h" #include "share.h" -/* retrieves ip address and port from a sockaddr structure. - note it calls Curl_inet_ntop which sets errno on fail, not SOCKERRNO. */ -bool getaddressinfo(struct sockaddr *sa, char *addr, long *port); - #include "memdebug.h" /* LAST include file */ static void unit_stop(void) @@ -154,9 +150,9 @@ UNITTEST_START if(!addr && !tests[i].address[j]) break; - if(addr && !getaddressinfo(addr->ai_addr, - ipaddress, &port)) { - fprintf(stderr, "%s:%d tests[%d] failed. getaddressinfo failed.\n", + if(addr && !Curl_addr2string(addr->ai_addr, addr->ai_addrlen, + ipaddress, &port)) { + fprintf(stderr, "%s:%d tests[%d] failed. Curl_addr2string failed.\n", __FILE__, __LINE__, i); problem = true; break; diff --git a/tests/unit/unit1654.c b/tests/unit/unit1654.c index 9d1a3e211..51fc5d16f 100644 --- a/tests/unit/unit1654.c +++ b/tests/unit/unit1654.c @@ -90,7 +90,7 @@ UNITTEST_START fail_unless(asi->num == 8, "wrong number of entries"); result = Curl_altsvc_parse(curl, asi, "h2=\"example.com:443\"; ma = 120;", - ALPN_h2c, "example.org", 80); + ALPN_h2, "example.org", 80); if(result) { fprintf(stderr, "Curl_altsvc_parse(4) failed!\n"); unitfail++; |