From: Jacob Mealey Date: Sat, 5 Jul 2025 14:52:10 -0400 Subject: introduce 'excludes' option for tests, address hexadecimal changes from libcurl Thanks @charles2910 for reporting this bug fixes: #394 libcurl 8.15 and newer parses hex addresses as upper case as RFC mandates, previous versions did lower case. This patches make it compatible with both. Bug: https://github.com/curl/trurl/issues/394 Origin: upstream, https://github.com/curl/trurl/pull/395 Last-Update: 2025-07-19 --- test.py | 7 +++- tests.json | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ trurl.c | 2 + 3 files changed, 132 insertions(+), 1 deletion(-) diff --git a/test.py b/test.py index f1c489c..a785565 100644 --- a/test.py +++ b/test.py @@ -250,11 +250,16 @@ def main(argc, argv): print(f"Missing feature, skipping test {testIndex + 1}.") numTestsSkipped += 1 continue + excludes = allTests[testIndex].get("excludes", None) + if excludes and set(excludes).issubset(set(features)): + print(f"Test not compatible, skipping test {testIndex + 1}") + numTestsSkipped += 1 + continue encoding = allTests[testIndex].get("encoding", None) if encoding and encoding != getcharmap(): print(f"Invalid locale, skipping test {testIndex + 1}.") numTestsSkipped += 1 - continue; + continue test = TestCase(testIndex + 1, runnerCmd, baseCmd, **allTests[testIndex]) diff --git a/tests.json b/tests.json index 891271c..10b995a 100644 --- a/tests.json +++ b/tests.json @@ -702,6 +702,7 @@ "user=:hej:" ] }, + "excludes": ["uppercase-hex"], "expected": { "stdout": "https://%3ahej%3a@curl.se/hello\n", "stderr": "", @@ -2030,6 +2031,7 @@ "localhost" ] }, + "excludes": ["uppercase-hex"], "expected": { "stdout": "/\\\\\n/%5c%5c\n", "returncode": 0, @@ -2045,6 +2047,7 @@ "localhost" ] }, + "excludes": ["uppercase-hex"], "expected": { "stdout": [ { @@ -2071,6 +2074,7 @@ "localhost" ] }, + "excludes": ["uppercase-hex"], "expected": { "stdout": "/%5c%5c\n/%5c%5c\n", "returncode": 0, @@ -2089,6 +2093,7 @@ "localhost" ] }, + "excludes": ["uppercase-hex"], "expected": { "stdout": [ { @@ -3318,5 +3323,124 @@ "stdout": "http://e/?e&a\n", "returncode": 0 } + }, + { + "input": { + "arguments": [ + "-s", + "path=\\\\", + "--json", + "localhost" + ] + }, + "required": ["uppercase-hex"], + "expected": { + "stdout": [ + { + "url": "http://localhost/%5C%5C", + "parts": { + "scheme": "http", + "host": "localhost", + "path": "/\\\\" + } + } + ], + "returncode": 0, + "stderr": "" + } + }, + { + "input": { + "arguments": [ + "-s", + "path=\\\\", + "-g", + "{path}\\n{:path}", + "--urlencode", + "localhost" + ] + }, + "required": ["uppercase-hex"], + "expected": { + "stdout": "/%5C%5C\n/%5C%5C\n", + "returncode": 0, + "stderr": "" + } + }, + { + "input": { + "arguments": [ + "-s", + "path=abc\\\\", + "-s", + "query:=a&b&a%26b", + "--urlencode", + "--json", + "localhost" + ] + }, + "required": ["uppercase-hex"], + "expected": { + "stdout": [ + { + "url": "http://localhost/abc%5C%5C?a&b&a%26b", + "parts": { + "scheme": "http", + "host": "localhost", + "path": "/abc%5C%5C", + "query": "a&b&a%26b" + }, + "params": [ + { + "key": "a", + "value": "" + }, + { + "key": "b", + "value": "" + }, + { + "key": "a&b", + "value": "" + } + ] + } + ], + "returncode": 0, + "stderr": "" + } + }, + { + "input": { + "arguments": [ + "--url", + "https://curl.se/hello", + "--set", + "user=:hej:" + ] + }, + "required": ["uppercase-hex"], + "expected": { + "stdout": "https://%3Ahej%3A@curl.se/hello\n", + "stderr": "", + "returncode": 0 + } + }, + { + "input": { + "arguments": [ + "-s", + "path=\\\\", + "-g", + "{path}\\n{:path}", + "localhost" + ] + }, + "required": ["uppercase-hex"], + "expected": { + "stdout": "/\\\\\n/%5C%5C\n", + "returncode": 0, + "stderr": "" + } } ] diff --git a/trurl.c b/trurl.c index b5a716c..90c408e 100644 --- a/trurl.c +++ b/trurl.c @@ -316,6 +316,8 @@ static void show_version(void) #ifdef SUPPORTS_ZONEID fprintf(stdout, " zone-id"); #endif + if(data->version_num >= 0x080f00) + fprintf(stdout, " uppercase-hex"); fprintf(stdout, "\n"); exit(0);