1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00
curl/tests/libtest
Daniel Stenberg 56a037cc0a
urlapi: "normalize" numerical IPv4 host names
When the host name in a URL is given as an IPv4 numerical address, the
address can be specified with dotted numericals in four different ways:
a32, a.b24, a.b.c16 or a.b.c.d and each part can be specified in
decimal, octal (0-prefixed) or hexadecimal (0x-prefixed).

Instead of passing on the name as-is and leaving the handling to the
underlying name functions, which made them not work with c-ares but work
with getaddrinfo, this change now makes the curl URL API itself detect
and "normalize" host names specified as IPv4 numericals.

The WHATWG URL Spec says this is an okay way to specify a host name in a
URL. RFC 3896 does not allow them, but curl didn't prevent them before
and it seems other RFC 3896-using tools have not either. Host names used
like this are widely supported by other tools as well due to the
handling being done by getaddrinfo and friends.

I decided to add the functionality into the URL API itself so that all
users of these functions get the benefits, when for example wanting to
compare two URLs. Also, it makes curl built to use c-ares now support
them as well and make curl builds more consistent.

The normalization makes HTTPS and virtual hosted HTTP work fine even
when curl gets the address specified using one of the "obscure" formats.

Test 1560 is extended to verify.

Fixes #6863
Closes #6871
2021-04-19 08:34:55 +02:00
..
.checksrc checksrc: ban gmtime/localtime 2020-07-28 23:51:17 +02:00
.gitignore git: ignore libtests in 3XXX area 2020-08-26 22:53:02 +02:00
chkdecimalpoint.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
chkhostname.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
CMakeLists.txt curl.se: new home 2020-11-04 23:59:47 +01:00
first.c language: s/behaviour/behavior/g 2021-01-02 23:35:59 +01:00
lib500.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib501.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib502.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib503.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib504.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib505.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib506.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib507.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib508.c docs/examples: adjust prototypes for CURLOPT_READFUNCTION 2020-12-30 22:20:24 +01:00
lib509.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib510.c docs/examples: adjust prototypes for CURLOPT_READFUNCTION 2020-12-30 22:20:24 +01:00
lib511.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib512.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib513.c docs/examples: adjust prototypes for CURLOPT_READFUNCTION 2020-12-30 22:20:24 +01:00
lib514.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib515.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib516.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib517.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib518.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib519.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib520.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib521.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib523.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib524.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib525.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib526.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib530.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib533.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib537.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib539.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib540.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib541.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib542.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib543.c tests: reduce variable scopes 2021-02-10 16:47:09 +01:00
lib544.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib547.c docs/examples: adjust prototypes for CURLOPT_READFUNCTION 2020-12-30 22:20:24 +01:00
lib549.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib552.c docs/examples: adjust prototypes for CURLOPT_READFUNCTION 2020-12-30 22:20:24 +01:00
lib553.c docs/examples: adjust prototypes for CURLOPT_READFUNCTION 2020-12-30 22:20:24 +01:00
lib554.c docs/examples: adjust prototypes for CURLOPT_READFUNCTION 2020-12-30 22:20:24 +01:00
lib555.c docs/examples: adjust prototypes for CURLOPT_READFUNCTION 2020-12-30 22:20:24 +01:00
lib556.c copyright: update copyright year ranges to 2021 2021-03-27 23:00:14 +01:00
lib557.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib558.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib559.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib560.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib562.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib564.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib566.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib567.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib568.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib569.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib570.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib571.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib572.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib573.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib574.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib575.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib576.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib578.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib579.c docs/examples: adjust prototypes for CURLOPT_READFUNCTION 2020-12-30 22:20:24 +01:00
lib582.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib583.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib586.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib589.c mime: make sure setting MIMEPOST to NULL resets properly 2021-01-15 08:33:27 +01:00
lib590.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib591.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib597.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib598.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib599.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib643.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib650.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib651.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib652.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib653.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib654.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib655.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib658.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib659.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib661.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib666.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib667.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib668.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib670.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib674.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib676.c cookie: CURLOPT_COOKIEFILE set to NULL switches off cookies 2021-04-14 23:09:36 +02:00
lib1156.c http: make 416 not fail with resume + CURLOPT_FAILONERRROR 2021-03-17 08:26:46 +01:00
lib1500.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1501.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1502.c lib/unit tests: add missing curl_global_cleanup() calls 2021-01-06 15:13:45 +01:00
lib1506.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1507.c docs/examples: adjust prototypes for CURLOPT_READFUNCTION 2020-12-30 22:20:24 +01:00
lib1508.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib1509.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib1510.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1511.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1512.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1513.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1514.c docs/examples: adjust prototypes for CURLOPT_READFUNCTION 2020-12-30 22:20:24 +01:00
lib1515.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib1517.c docs/examples: adjust prototypes for CURLOPT_READFUNCTION 2020-12-30 22:20:24 +01:00
lib1518.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1520.c docs/examples: adjust prototypes for CURLOPT_READFUNCTION 2020-12-30 22:20:24 +01:00
lib1522.c test1522: add debug tracing 2020-12-17 16:55:56 +01:00
lib1523.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib1525.c docs/examples: adjust prototypes for CURLOPT_READFUNCTION 2020-12-30 22:20:24 +01:00
lib1526.c docs/examples: adjust prototypes for CURLOPT_READFUNCTION 2020-12-30 22:20:24 +01:00
lib1527.c docs/examples: adjust prototypes for CURLOPT_READFUNCTION 2020-12-30 22:20:24 +01:00
lib1528.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1529.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1530.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1531.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib1532.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1533.c docs/examples: adjust prototypes for CURLOPT_READFUNCTION 2020-12-30 22:20:24 +01:00
lib1534.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1535.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib1536.c copyright: update copyright year ranges to 2021 2021-03-27 23:00:14 +01:00
lib1537.c copyright: update copyright year ranges to 2021 2021-03-27 23:00:14 +01:00
lib1538.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib1540.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib1541.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib1550.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1551.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1552.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1553.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1554.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib1555.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1556.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1557.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1558.c infof/failf calls: fix format specifiers 2020-11-24 13:18:41 +01:00
lib1559.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1560.c urlapi: "normalize" numerical IPv4 host names 2021-04-19 08:34:55 +02:00
lib1564.c lib1564/5: verify that curl_multi_wakeup returns OK 2020-12-11 17:42:17 +01:00
lib1565.c lib1564/5: verify that curl_multi_wakeup returns OK 2020-12-11 17:42:17 +01:00
lib1567.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib1568.c lib/unit tests: add missing curl_global_cleanup() calls 2021-01-06 15:13:45 +01:00
lib1569.c ftp: add 'prefer_ascii' to the transfer state struct 2021-02-09 14:06:28 +01:00
lib1591.c docs/examples: adjust prototypes for CURLOPT_READFUNCTION 2020-12-30 22:20:24 +01:00
lib1592.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib1593.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1594.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1900.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib1905.c lib/unit tests: add missing curl_global_cleanup() calls 2021-01-06 15:13:45 +01:00
lib1906.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1907.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
lib1908.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib1910.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib1911.c lib/unit tests: add missing curl_global_cleanup() calls 2021-01-06 15:13:45 +01:00
lib1912.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib1913.c curl.se: new home 2020-11-04 23:59:47 +01:00
lib1915.c infof/failf calls: fix format specifiers 2020-11-24 13:18:41 +01:00
lib1916.c mqtt: handle POST/PUBLISH without a set POSTFIELDSIZE 2020-12-18 12:54:05 +01:00
lib1918.c test1918: verify curl_easy_option_by_name() and curl_easy_option_by_id() 2021-01-15 17:03:29 +01:00
lib1933.c copyright: fix year ranges in need of updates 2021-02-03 08:02:36 +01:00
lib1934.c copyright: fix year ranges in need of updates 2021-02-03 08:02:36 +01:00
lib1935.c copyright: fix year ranges in need of updates 2021-02-03 08:02:36 +01:00
lib1936.c copyright: fix year ranges in need of updates 2021-02-03 08:02:36 +01:00
lib3010.c curl.se: new home 2020-11-04 23:59:47 +01:00
libauthretry.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
libntlmconnect.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
Makefile.am examples/libtest: add .checksrc to dist 2020-12-21 17:06:06 +01:00
Makefile.inc cookie: CURLOPT_COOKIEFILE set to NULL switches off cookies 2021-04-14 23:09:36 +02:00
mk-lib1521.pl curl.se: new home 2020-11-04 23:59:47 +01:00
notexists.pl curl.se: new home 2020-11-04 23:59:47 +01:00
sethostname.c curl.se: new home 2020-11-04 23:59:47 +01:00
sethostname.h curl.se: new home 2020-11-04 23:59:47 +01:00
stub_gssapi.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
stub_gssapi.h curl.se: new home 2020-11-04 23:59:47 +01:00
test307.pl curl.se: new home 2020-11-04 23:59:47 +01:00
test610.pl curl.se: new home 2020-11-04 23:59:47 +01:00
test613.pl curl.se: new home 2020-11-04 23:59:47 +01:00
test1013.pl configure: provide Largefile feature for curl-config 2021-03-11 10:12:30 +01:00
test1022.pl curl.se: new home 2020-11-04 23:59:47 +01:00
test.h curl.se: new home 2020-11-04 23:59:47 +01:00
testtrace.c copyright: fix year ranges 2020-11-05 08:22:10 +01:00
testtrace.h curl.se: new home 2020-11-04 23:59:47 +01:00
testutil.c curl.se: new home 2020-11-04 23:59:47 +01:00
testutil.h curl.se: new home 2020-11-04 23:59:47 +01:00