]> git.proxmox.com Git - libgit2.git/blob - tests/network/url/parse.c
New upstream version 1.4.3+dfsg.1
[libgit2.git] / tests / network / url / parse.c
1 #include "clar_libgit2.h"
2 #include "net.h"
3
4 static git_net_url conndata;
5
6 void test_network_url_parse__initialize(void)
7 {
8 memset(&conndata, 0, sizeof(conndata));
9 }
10
11 void test_network_url_parse__cleanup(void)
12 {
13 git_net_url_dispose(&conndata);
14 }
15
16 /* Hostname */
17
18 void test_network_url_parse__hostname_trivial(void)
19 {
20 cl_git_pass(git_net_url_parse(&conndata, "http://example.com/resource"));
21 cl_assert_equal_s(conndata.scheme, "http");
22 cl_assert_equal_s(conndata.host, "example.com");
23 cl_assert_equal_s(conndata.port, "80");
24 cl_assert_equal_s(conndata.path, "/resource");
25 cl_assert_equal_p(conndata.username, NULL);
26 cl_assert_equal_p(conndata.password, NULL);
27 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
28 }
29
30 void test_network_url_parse__hostname_root(void)
31 {
32 cl_git_pass(git_net_url_parse(&conndata, "http://example.com/"));
33 cl_assert_equal_s(conndata.scheme, "http");
34 cl_assert_equal_s(conndata.host, "example.com");
35 cl_assert_equal_s(conndata.port, "80");
36 cl_assert_equal_s(conndata.path, "/");
37 cl_assert_equal_p(conndata.username, NULL);
38 cl_assert_equal_p(conndata.password, NULL);
39 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
40 }
41
42 void test_network_url_parse__hostname_implied_root(void)
43 {
44 cl_git_pass(git_net_url_parse(&conndata, "http://example.com"));
45 cl_assert_equal_s(conndata.scheme, "http");
46 cl_assert_equal_s(conndata.host, "example.com");
47 cl_assert_equal_s(conndata.port, "80");
48 cl_assert_equal_s(conndata.path, "/");
49 cl_assert_equal_p(conndata.username, NULL);
50 cl_assert_equal_p(conndata.password, NULL);
51 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
52 }
53
54 void test_network_url_parse__hostname_implied_root_custom_port(void)
55 {
56 cl_git_pass(git_net_url_parse(&conndata, "http://example.com:42"));
57 cl_assert_equal_s(conndata.scheme, "http");
58 cl_assert_equal_s(conndata.host, "example.com");
59 cl_assert_equal_s(conndata.port, "42");
60 cl_assert_equal_s(conndata.path, "/");
61 cl_assert_equal_p(conndata.username, NULL);
62 cl_assert_equal_p(conndata.password, NULL);
63 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
64 }
65
66 void test_network_url_parse__hostname_implied_root_empty_port(void)
67 {
68 cl_git_pass(git_net_url_parse(&conndata, "http://example.com:"));
69 cl_assert_equal_s(conndata.scheme, "http");
70 cl_assert_equal_s(conndata.host, "example.com");
71 cl_assert_equal_s(conndata.port, "80");
72 cl_assert_equal_s(conndata.path, "/");
73 cl_assert_equal_p(conndata.username, NULL);
74 cl_assert_equal_p(conndata.password, NULL);
75 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
76 }
77
78 void test_network_url_parse__hostname_encoded_password(void)
79 {
80 cl_git_pass(git_net_url_parse(&conndata,
81 "https://user:pass%2fis%40bad@hostname.com:1234/"));
82 cl_assert_equal_s(conndata.scheme, "https");
83 cl_assert_equal_s(conndata.host, "hostname.com");
84 cl_assert_equal_s(conndata.port, "1234");
85 cl_assert_equal_s(conndata.path, "/");
86 cl_assert_equal_s(conndata.username, "user");
87 cl_assert_equal_s(conndata.password, "pass/is@bad");
88 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
89 }
90
91 void test_network_url_parse__hostname_user(void)
92 {
93 cl_git_pass(git_net_url_parse(&conndata,
94 "https://user@example.com/resource"));
95 cl_assert_equal_s(conndata.scheme, "https");
96 cl_assert_equal_s(conndata.host, "example.com");
97 cl_assert_equal_s(conndata.port, "443");
98 cl_assert_equal_s(conndata.path, "/resource");
99 cl_assert_equal_s(conndata.username, "user");
100 cl_assert_equal_p(conndata.password, NULL);
101 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
102 }
103
104 void test_network_url_parse__hostname_user_pass(void)
105 {
106 /* user:pass@hostname.tld/resource */
107 cl_git_pass(git_net_url_parse(&conndata,
108 "https://user:pass@example.com/resource"));
109 cl_assert_equal_s(conndata.scheme, "https");
110 cl_assert_equal_s(conndata.host, "example.com");
111 cl_assert_equal_s(conndata.port, "443");
112 cl_assert_equal_s(conndata.path, "/resource");
113 cl_assert_equal_s(conndata.username, "user");
114 cl_assert_equal_s(conndata.password, "pass");
115 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
116 }
117
118 void test_network_url_parse__hostname_port(void)
119 {
120 /* hostname.tld:port/resource */
121 cl_git_pass(git_net_url_parse(&conndata,
122 "https://example.com:9191/resource"));
123 cl_assert_equal_s(conndata.scheme, "https");
124 cl_assert_equal_s(conndata.host, "example.com");
125 cl_assert_equal_s(conndata.port, "9191");
126 cl_assert_equal_s(conndata.path, "/resource");
127 cl_assert_equal_p(conndata.username, NULL);
128 cl_assert_equal_p(conndata.password, NULL);
129 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
130 }
131
132 void test_network_url_parse__hostname_empty_port(void)
133 {
134 cl_git_pass(git_net_url_parse(&conndata, "http://example.com:/resource"));
135 cl_assert_equal_s(conndata.scheme, "http");
136 cl_assert_equal_s(conndata.host, "example.com");
137 cl_assert_equal_s(conndata.port, "80");
138 cl_assert_equal_s(conndata.path, "/resource");
139 cl_assert_equal_p(conndata.username, NULL);
140 cl_assert_equal_p(conndata.password, NULL);
141 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
142 }
143
144 void test_network_url_parse__hostname_user_port(void)
145 {
146 /* user@hostname.tld:port/resource */
147 cl_git_pass(git_net_url_parse(&conndata,
148 "https://user@example.com:9191/resource"));
149 cl_assert_equal_s(conndata.scheme, "https");
150 cl_assert_equal_s(conndata.host, "example.com");
151 cl_assert_equal_s(conndata.port, "9191");
152 cl_assert_equal_s(conndata.path, "/resource");
153 cl_assert_equal_s(conndata.username, "user");
154 cl_assert_equal_p(conndata.password, NULL);
155 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
156 }
157
158 void test_network_url_parse__hostname_user_pass_port(void)
159 {
160 /* user:pass@hostname.tld:port/resource */
161 cl_git_pass(git_net_url_parse(&conndata,
162 "https://user:pass@example.com:9191/resource"));
163 cl_assert_equal_s(conndata.scheme, "https");
164 cl_assert_equal_s(conndata.host, "example.com");
165 cl_assert_equal_s(conndata.port, "9191");
166 cl_assert_equal_s(conndata.path, "/resource");
167 cl_assert_equal_s(conndata.username, "user");
168 cl_assert_equal_s(conndata.password, "pass");
169 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
170 }
171
172 /* IPv4 addresses */
173
174 void test_network_url_parse__ipv4_trivial(void)
175 {
176 cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1/resource"));
177 cl_assert_equal_s(conndata.scheme, "http");
178 cl_assert_equal_s(conndata.host, "192.168.1.1");
179 cl_assert_equal_s(conndata.port, "80");
180 cl_assert_equal_s(conndata.path, "/resource");
181 cl_assert_equal_p(conndata.username, NULL);
182 cl_assert_equal_p(conndata.password, NULL);
183 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
184 }
185
186 void test_network_url_parse__ipv4_root(void)
187 {
188 cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1/"));
189 cl_assert_equal_s(conndata.scheme, "http");
190 cl_assert_equal_s(conndata.host, "192.168.1.1");
191 cl_assert_equal_s(conndata.port, "80");
192 cl_assert_equal_s(conndata.path, "/");
193 cl_assert_equal_p(conndata.username, NULL);
194 cl_assert_equal_p(conndata.password, NULL);
195 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
196 }
197
198 void test_network_url_parse__ipv4_implied_root(void)
199 {
200 cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1"));
201 cl_assert_equal_s(conndata.scheme, "http");
202 cl_assert_equal_s(conndata.host, "192.168.1.1");
203 cl_assert_equal_s(conndata.port, "80");
204 cl_assert_equal_s(conndata.path, "/");
205 cl_assert_equal_p(conndata.username, NULL);
206 cl_assert_equal_p(conndata.password, NULL);
207 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
208 }
209
210 void test_network_url_parse__ipv4_implied_root_custom_port(void)
211 {
212 cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1:42"));
213 cl_assert_equal_s(conndata.scheme, "http");
214 cl_assert_equal_s(conndata.host, "192.168.1.1");
215 cl_assert_equal_s(conndata.port, "42");
216 cl_assert_equal_s(conndata.path, "/");
217 cl_assert_equal_p(conndata.username, NULL);
218 cl_assert_equal_p(conndata.password, NULL);
219 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
220 }
221
222 void test_network_url_parse__ipv4_implied_root_empty_port(void)
223 {
224 cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1:"));
225 cl_assert_equal_s(conndata.scheme, "http");
226 cl_assert_equal_s(conndata.host, "192.168.1.1");
227 cl_assert_equal_s(conndata.port, "80");
228 cl_assert_equal_s(conndata.path, "/");
229 cl_assert_equal_p(conndata.username, NULL);
230 cl_assert_equal_p(conndata.password, NULL);
231 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
232 }
233
234 void test_network_url_parse__ipv4_encoded_password(void)
235 {
236 cl_git_pass(git_net_url_parse(&conndata,
237 "https://user:pass%2fis%40bad@192.168.1.1:1234/"));
238 cl_assert_equal_s(conndata.scheme, "https");
239 cl_assert_equal_s(conndata.host, "192.168.1.1");
240 cl_assert_equal_s(conndata.port, "1234");
241 cl_assert_equal_s(conndata.path, "/");
242 cl_assert_equal_s(conndata.username, "user");
243 cl_assert_equal_s(conndata.password, "pass/is@bad");
244 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
245 }
246
247 void test_network_url_parse__ipv4_user(void)
248 {
249 cl_git_pass(git_net_url_parse(&conndata,
250 "https://user@192.168.1.1/resource"));
251 cl_assert_equal_s(conndata.scheme, "https");
252 cl_assert_equal_s(conndata.host, "192.168.1.1");
253 cl_assert_equal_s(conndata.port, "443");
254 cl_assert_equal_s(conndata.path, "/resource");
255 cl_assert_equal_s(conndata.username, "user");
256 cl_assert_equal_p(conndata.password, NULL);
257 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
258 }
259
260 void test_network_url_parse__ipv4_user_pass(void)
261 {
262 cl_git_pass(git_net_url_parse(&conndata,
263 "https://user:pass@192.168.1.1/resource"));
264 cl_assert_equal_s(conndata.scheme, "https");
265 cl_assert_equal_s(conndata.host, "192.168.1.1");
266 cl_assert_equal_s(conndata.port, "443");
267 cl_assert_equal_s(conndata.path, "/resource");
268 cl_assert_equal_s(conndata.username, "user");
269 cl_assert_equal_s(conndata.password, "pass");
270 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
271 }
272
273 void test_network_url_parse__ipv4_port(void)
274 {
275 cl_git_pass(git_net_url_parse(&conndata,
276 "https://192.168.1.1:9191/resource"));
277 cl_assert_equal_s(conndata.scheme, "https");
278 cl_assert_equal_s(conndata.host, "192.168.1.1");
279 cl_assert_equal_s(conndata.port, "9191");
280 cl_assert_equal_s(conndata.path, "/resource");
281 cl_assert_equal_p(conndata.username, NULL);
282 cl_assert_equal_p(conndata.password, NULL);
283 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
284 }
285
286 void test_network_url_parse__ipv4_empty_port(void)
287 {
288 cl_git_pass(git_net_url_parse(&conndata, "http://192.168.1.1:/resource"));
289 cl_assert_equal_s(conndata.scheme, "http");
290 cl_assert_equal_s(conndata.host, "192.168.1.1");
291 cl_assert_equal_s(conndata.port, "80");
292 cl_assert_equal_s(conndata.path, "/resource");
293 cl_assert_equal_p(conndata.username, NULL);
294 cl_assert_equal_p(conndata.password, NULL);
295 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
296 }
297
298 void test_network_url_parse__ipv4_user_port(void)
299 {
300 cl_git_pass(git_net_url_parse(&conndata,
301 "https://user@192.168.1.1:9191/resource"));
302 cl_assert_equal_s(conndata.scheme, "https");
303 cl_assert_equal_s(conndata.host, "192.168.1.1");
304 cl_assert_equal_s(conndata.port, "9191");
305 cl_assert_equal_s(conndata.path, "/resource");
306 cl_assert_equal_s(conndata.username, "user");
307 cl_assert_equal_p(conndata.password, NULL);
308 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
309 }
310
311 void test_network_url_parse__ipv4_user_pass_port(void)
312 {
313 cl_git_pass(git_net_url_parse(&conndata,
314 "https://user:pass@192.168.1.1:9191/resource"));
315 cl_assert_equal_s(conndata.scheme, "https");
316 cl_assert_equal_s(conndata.host, "192.168.1.1");
317 cl_assert_equal_s(conndata.port, "9191");
318 cl_assert_equal_s(conndata.path, "/resource");
319 cl_assert_equal_s(conndata.username, "user");
320 cl_assert_equal_s(conndata.password, "pass");
321 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
322 }
323
324 /* IPv6 addresses */
325
326 void test_network_url_parse__ipv6_trivial(void)
327 {
328 cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]/resource"));
329 cl_assert_equal_s(conndata.scheme, "http");
330 cl_assert_equal_s(conndata.host, "fe80::dcad:beff:fe00:0001");
331 cl_assert_equal_s(conndata.port, "80");
332 cl_assert_equal_s(conndata.path, "/resource");
333 cl_assert_equal_p(conndata.username, NULL);
334 cl_assert_equal_p(conndata.password, NULL);
335 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
336 }
337
338 void test_network_url_parse__ipv6_root(void)
339 {
340 cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]/"));
341 cl_assert_equal_s(conndata.scheme, "http");
342 cl_assert_equal_s(conndata.host, "fe80::dcad:beff:fe00:0001");
343 cl_assert_equal_s(conndata.port, "80");
344 cl_assert_equal_s(conndata.path, "/");
345 cl_assert_equal_p(conndata.username, NULL);
346 cl_assert_equal_p(conndata.password, NULL);
347 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
348 }
349
350 void test_network_url_parse__ipv6_implied_root(void)
351 {
352 cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]"));
353 cl_assert_equal_s(conndata.scheme, "http");
354 cl_assert_equal_s(conndata.host, "fe80::dcad:beff:fe00:0001");
355 cl_assert_equal_s(conndata.port, "80");
356 cl_assert_equal_s(conndata.path, "/");
357 cl_assert_equal_p(conndata.username, NULL);
358 cl_assert_equal_p(conndata.password, NULL);
359 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
360 }
361
362 void test_network_url_parse__ipv6_implied_root_custom_port(void)
363 {
364 cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]:42"));
365 cl_assert_equal_s(conndata.scheme, "http");
366 cl_assert_equal_s(conndata.host, "fe80::dcad:beff:fe00:0001");
367 cl_assert_equal_s(conndata.port, "42");
368 cl_assert_equal_s(conndata.path, "/");
369 cl_assert_equal_p(conndata.username, NULL);
370 cl_assert_equal_p(conndata.password, NULL);
371 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
372 }
373
374 void test_network_url_parse__ipv6_implied_root_empty_port(void)
375 {
376 cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]:"));
377 cl_assert_equal_s(conndata.scheme, "http");
378 cl_assert_equal_s(conndata.host, "fe80::dcad:beff:fe00:0001");
379 cl_assert_equal_s(conndata.port, "80");
380 cl_assert_equal_s(conndata.path, "/");
381 cl_assert_equal_p(conndata.username, NULL);
382 cl_assert_equal_p(conndata.password, NULL);
383 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
384 }
385
386 void test_network_url_parse__ipv6_encoded_password(void)
387 {
388 cl_git_pass(git_net_url_parse(&conndata,
389 "https://user:pass%2fis%40bad@[fe80::dcad:beff:fe00:0001]:1234/"));
390 cl_assert_equal_s(conndata.scheme, "https");
391 cl_assert_equal_s(conndata.host, "fe80::dcad:beff:fe00:0001");
392 cl_assert_equal_s(conndata.port, "1234");
393 cl_assert_equal_s(conndata.path, "/");
394 cl_assert_equal_s(conndata.username, "user");
395 cl_assert_equal_s(conndata.password, "pass/is@bad");
396 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
397 }
398
399 void test_network_url_parse__ipv6_user(void)
400 {
401 cl_git_pass(git_net_url_parse(&conndata,
402 "https://user@[fe80::dcad:beff:fe00:0001]/resource"));
403 cl_assert_equal_s(conndata.scheme, "https");
404 cl_assert_equal_s(conndata.host, "fe80::dcad:beff:fe00:0001");
405 cl_assert_equal_s(conndata.port, "443");
406 cl_assert_equal_s(conndata.path, "/resource");
407 cl_assert_equal_s(conndata.username, "user");
408 cl_assert_equal_p(conndata.password, NULL);
409 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
410 }
411
412 void test_network_url_parse__ipv6_user_pass(void)
413 {
414 cl_git_pass(git_net_url_parse(&conndata,
415 "https://user:pass@[fe80::dcad:beff:fe00:0001]/resource"));
416 cl_assert_equal_s(conndata.scheme, "https");
417 cl_assert_equal_s(conndata.host, "fe80::dcad:beff:fe00:0001");
418 cl_assert_equal_s(conndata.port, "443");
419 cl_assert_equal_s(conndata.path, "/resource");
420 cl_assert_equal_s(conndata.username, "user");
421 cl_assert_equal_s(conndata.password, "pass");
422 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
423 }
424
425 void test_network_url_parse__ipv6_port(void)
426 {
427 cl_git_pass(git_net_url_parse(&conndata,
428 "https://[fe80::dcad:beff:fe00:0001]:9191/resource"));
429 cl_assert_equal_s(conndata.scheme, "https");
430 cl_assert_equal_s(conndata.host, "fe80::dcad:beff:fe00:0001");
431 cl_assert_equal_s(conndata.port, "9191");
432 cl_assert_equal_s(conndata.path, "/resource");
433 cl_assert_equal_p(conndata.username, NULL);
434 cl_assert_equal_p(conndata.password, NULL);
435 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
436 }
437
438 void test_network_url_parse__ipv6_empty_port(void)
439 {
440 cl_git_pass(git_net_url_parse(&conndata, "http://[fe80::dcad:beff:fe00:0001]:/resource"));
441 cl_assert_equal_s(conndata.scheme, "http");
442 cl_assert_equal_s(conndata.host, "fe80::dcad:beff:fe00:0001");
443 cl_assert_equal_s(conndata.port, "80");
444 cl_assert_equal_s(conndata.path, "/resource");
445 cl_assert_equal_p(conndata.username, NULL);
446 cl_assert_equal_p(conndata.password, NULL);
447 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1);
448 }
449
450 void test_network_url_parse__ipv6_user_port(void)
451 {
452 cl_git_pass(git_net_url_parse(&conndata,
453 "https://user@[fe80::dcad:beff:fe00:0001]:9191/resource"));
454 cl_assert_equal_s(conndata.scheme, "https");
455 cl_assert_equal_s(conndata.host, "fe80::dcad:beff:fe00:0001");
456 cl_assert_equal_s(conndata.port, "9191");
457 cl_assert_equal_s(conndata.path, "/resource");
458 cl_assert_equal_s(conndata.username, "user");
459 cl_assert_equal_p(conndata.password, NULL);
460 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
461 }
462
463 void test_network_url_parse__ipv6_user_pass_port(void)
464 {
465 cl_git_pass(git_net_url_parse(&conndata,
466 "https://user:pass@[fe80::dcad:beff:fe00:0001]:9191/resource"));
467 cl_assert_equal_s(conndata.scheme, "https");
468 cl_assert_equal_s(conndata.host, "fe80::dcad:beff:fe00:0001");
469 cl_assert_equal_s(conndata.port, "9191");
470 cl_assert_equal_s(conndata.path, "/resource");
471 cl_assert_equal_s(conndata.username, "user");
472 cl_assert_equal_s(conndata.password, "pass");
473 cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0);
474 }
475
476 void test_network_url_parse__ipv6_invalid_addresses(void)
477 {
478 /* Opening bracket missing */
479 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
480 "http://fe80::dcad:beff:fe00:0001]/resource"));
481 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
482 "http://fe80::dcad:beff:fe00:0001]/"));
483 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
484 "http://fe80::dcad:beff:fe00:0001]"));
485 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
486 "http://fe80::dcad:beff:fe00:0001]:42"));
487 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
488 "http://fe80::dcad:beff:fe00:0001]:"));
489 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
490 "https://user:pass%2fis%40bad@fe80::dcad:beff:fe00:0001]:1234/"));
491 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
492 "https://user@fe80::dcad:beff:fe00:0001]/resource"));
493 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
494 "https://user:pass@fe80::dcad:beff:fe00:0001]/resource"));
495 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
496 "https://fe80::dcad:beff:fe00:0001]:9191/resource"));
497 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
498 "http://fe80::dcad:beff:fe00:0001]:/resource"));
499 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
500 "https://user@fe80::dcad:beff:fe00:0001]:9191/resource"));
501 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
502 "https://user:pass@fe80::dcad:beff:fe00:0001]:9191/resource"));
503
504 /* Closing bracket missing */
505 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
506 "http://[fe80::dcad:beff:fe00:0001/resource"));
507 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
508 "http://[fe80::dcad:beff:fe00:0001/"));
509 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
510 "http://[fe80::dcad:beff:fe00:0001"));
511 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
512 "http://[fe80::dcad:beff:fe00:0001:42"));
513 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
514 "http://[fe80::dcad:beff:fe00:0001:"));
515 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
516 "https://user:pass%2fis%40bad@[fe80::dcad:beff:fe00:0001:1234/"));
517 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
518 "https://user@[fe80::dcad:beff:fe00:0001/resource"));
519 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
520 "https://user:pass@[fe80::dcad:beff:fe00:0001/resource"));
521 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
522 "https://[fe80::dcad:beff:fe00:0001:9191/resource"));
523 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
524 "http://[fe80::dcad:beff:fe00:0001:/resource"));
525 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
526 "https://user@[fe80::dcad:beff:fe00:0001:9191/resource"));
527 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
528 "https://user:pass@[fe80::dcad:beff:fe00:0001:9191/resource"));
529 /* Both brackets missing */
530 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
531 "http://fe80::dcad:beff:fe00:0001/resource"));
532 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
533 "http://fe80::dcad:beff:fe00:0001/"));
534 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
535 "http://fe80::dcad:beff:fe00:0001"));
536 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
537 "http://fe80::dcad:beff:fe00:0001:42"));
538 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
539 "http://fe80::dcad:beff:fe00:0001:"));
540 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
541 "https://user:pass%2fis%40bad@fe80::dcad:beff:fe00:0001:1234/"));
542 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
543 "https://user@fe80::dcad:beff:fe00:0001/resource"));
544 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
545 "https://user:pass@fe80::dcad:beff:fe00:0001/resource"));
546 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
547 "https://fe80::dcad:beff:fe00:0001:9191/resource"));
548 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
549 "http://fe80::dcad:beff:fe00:0001:/resource"));
550 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
551 "https://user@fe80::dcad:beff:fe00:0001:9191/resource"));
552 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata,
553 "https://user:pass@fe80::dcad:beff:fe00:0001:9191/resource"));
554
555 /* Invalid character inside address */
556 cl_git_fail_with(GIT_EINVALIDSPEC, git_net_url_parse(&conndata, "http://[fe8o::dcad:beff:fe00:0001]/resource"));
557 }