From f2fda908f922836134fec313d20b24f7cc2d8937 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 13 Jul 2026 21:52:53 +0200 Subject: [PATCH] lib1560: test CURLU_DEFAULT_PORT more Closes #22314 --- tests/data/test1560 | 2 +- tests/libtest/lib1560.c | 61 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/tests/data/test1560 b/tests/data/test1560 index 70de44d31e..f4cbaa8e0e 100644 --- a/tests/data/test1560 +++ b/tests/data/test1560 @@ -36,7 +36,7 @@ lib%TESTNUMBER success -Allocations: 3450 +Allocations: 3550 diff --git a/tests/libtest/lib1560.c b/tests/libtest/lib1560.c index 9fb546bc05..5eda0bc6dc 100644 --- a/tests/libtest/lib1560.c +++ b/tests/libtest/lib1560.c @@ -554,9 +554,70 @@ static const struct testcase get_parts_list[] = { {"file:///hello.html", "file | [11] | [12] | [13] | [14] | [15] | /hello.html | [16] | [17]", 0, 0, CURLUE_OK}, + + /* verify that we get the right default ports */ {"https://127.0.0.1", "https | [11] | [12] | [13] | 127.0.0.1 | 443 | / | [16] | [17]", 0, CURLU_DEFAULT_PORT, CURLUE_OK}, + {"http://127.0.0.1", + "http | [11] | [12] | [13] | 127.0.0.1 | 80 | / | [16] | [17]", + 0, CURLU_DEFAULT_PORT, CURLUE_OK}, + {"ftp://127.0.0.1", + "ftp | [11] | [12] | [13] | 127.0.0.1 | 21 | / | [16] | [17]", + 0, CURLU_DEFAULT_PORT, CURLUE_OK}, + {"ftps://127.0.0.1", + "ftps | [11] | [12] | [13] | 127.0.0.1 | 990 | / | [16] | [17]", + 0, CURLU_DEFAULT_PORT, CURLUE_OK}, + {"scp://127.0.0.1", + "scp | [11] | [12] | [13] | 127.0.0.1 | 22 | / | [16] | [17]", + 0, CURLU_DEFAULT_PORT, CURLUE_OK}, + {"sftp://127.0.0.1", + "sftp | [11] | [12] | [13] | 127.0.0.1 | 22 | / | [16] | [17]", + 0, CURLU_DEFAULT_PORT, CURLUE_OK}, + {"imap://127.0.0.1", + "imap | [11] | [12] | [13] | 127.0.0.1 | 143 | / | [16] | [17]", + 0, CURLU_DEFAULT_PORT, CURLUE_OK}, + {"imaps://127.0.0.1", + "imaps | [11] | [12] | [13] | 127.0.0.1 | 993 | / | [16] | [17]", + 0, CURLU_DEFAULT_PORT, CURLUE_OK}, + {"smtp://127.0.0.1", + "smtp | [11] | [12] | [13] | 127.0.0.1 | 25 | / | [16] | [17]", + 0, CURLU_DEFAULT_PORT, CURLUE_OK}, + {"smtps://127.0.0.1", + "smtps | [11] | [12] | [13] | 127.0.0.1 | 465 | / | [16] | [17]", + 0, CURLU_DEFAULT_PORT, CURLUE_OK}, + {"pop3://127.0.0.1", + "pop3 | [11] | [12] | [13] | 127.0.0.1 | 110 | / | [16] | [17]", + 0, CURLU_DEFAULT_PORT, CURLUE_OK}, + {"pop3s://127.0.0.1", + "pop3s | [11] | [12] | [13] | 127.0.0.1 | 995 | / | [16] | [17]", + 0, CURLU_DEFAULT_PORT, CURLUE_OK}, +#ifndef CURL_DISABLE_WEBSOCKETS + {"ws://127.0.0.1", + "ws | [11] | [12] | [13] | 127.0.0.1 | 80 | / | [16] | [17]", + 0, CURLU_DEFAULT_PORT, CURLUE_OK}, + {"wss://127.0.0.1", + "wss | [11] | [12] | [13] | 127.0.0.1 | 443 | / | [16] | [17]", + 0, CURLU_DEFAULT_PORT, CURLUE_OK}, +#endif + {"telnet://127.0.0.1", + "telnet | [11] | [12] | [13] | 127.0.0.1 | 23 | / | [16] | [17]", + 0, CURLU_DEFAULT_PORT, CURLUE_OK}, + {"gopher://127.0.0.1", + "gopher | [11] | [12] | [13] | 127.0.0.1 | 70 | / | [16] | [17]", + 0, CURLU_DEFAULT_PORT, CURLUE_OK}, + {"gophers://127.0.0.1", + "gophers | [11] | [12] | [13] | 127.0.0.1 | 70 | / | [16] | [17]", + 0, CURLU_DEFAULT_PORT, CURLUE_OK}, +#ifndef CURL_DISABLE_LDAP + {"ldap://127.0.0.1", + "ldap | [11] | [12] | [13] | 127.0.0.1 | 389 | / | [16] | [17]", + 0, CURLU_DEFAULT_PORT, CURLUE_OK}, + {"ldaps://127.0.0.1", + "ldaps | [11] | [12] | [13] | 127.0.0.1 | 636 | / | [16] | [17]", + 0, CURLU_DEFAULT_PORT, CURLUE_OK}, +#endif + {"https://127.0.0.1", "https | [11] | [12] | [13] | 127.0.0.1 | [15] | / | [16] | [17]", CURLU_DEFAULT_SCHEME, 0, CURLUE_OK},