File: fix-tests-for-newer-libcurl.patch

package info (click to toggle)
trurl 0.16.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 660 kB
  • sloc: ansic: 1,857; perl: 1,190; python: 205; sh: 81; makefile: 56
file content (224 lines) | stat: -rw-r--r-- 6,356 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
From: Jacob Mealey <jacobmealey.maine@gmail.com>
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);