[URLMON_WINETEST] Sync with Wine Staging 4.0. CORE-15682
[reactos.git] / modules / rostests / winetests / urlmon / uri.c
1 /*
2 * UrlMon IUri tests
3 *
4 * Copyright 2010 Thomas Mullaly
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #include <wine/test.h>
22 #include <stdarg.h>
23 #include <stddef.h>
24
25 #define COBJMACROS
26 #define CONST_VTABLE
27 #define WIN32_LEAN_AND_MEAN
28
29 #include "windef.h"
30 #include "winbase.h"
31 #include "urlmon.h"
32 #include "shlwapi.h"
33 #include "wininet.h"
34 #include "strsafe.h"
35 #include "initguid.h"
36 #include <wine/heap.h>
37
38 DEFINE_GUID(CLSID_CUri, 0xDF2FCE13, 0x25EC, 0x45BB, 0x9D,0x4C, 0xCE,0xCD,0x47,0xC2,0x43,0x0C);
39
40 #define URI_STR_PROPERTY_COUNT Uri_PROPERTY_STRING_LAST+1
41 #define URI_DWORD_PROPERTY_COUNT (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1
42 #define URI_BUILDER_STR_PROPERTY_COUNT 7
43
44 #define DEFINE_EXPECT(func) \
45 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
46
47 #define SET_EXPECT(func) \
48 expect_ ## func = TRUE
49
50 #define CHECK_EXPECT(func) \
51 do { \
52 ok(expect_ ##func, "unexpected call " #func "\n"); \
53 expect_ ## func = FALSE; \
54 called_ ## func = TRUE; \
55 }while(0)
56
57 #define CHECK_EXPECT2(func) \
58 do { \
59 ok(expect_ ##func, "unexpected call " #func "\n"); \
60 called_ ## func = TRUE; \
61 }while(0)
62
63 #define CHECK_CALLED(func) \
64 do { \
65 ok(called_ ## func, "expected " #func "\n"); \
66 expect_ ## func = called_ ## func = FALSE; \
67 }while(0)
68
69 DEFINE_EXPECT(CombineUrl);
70 DEFINE_EXPECT(ParseUrl);
71
72 static HRESULT (WINAPI *pCreateUri)(LPCWSTR, DWORD, DWORD_PTR, IUri**);
73 static HRESULT (WINAPI *pCreateUriWithFragment)(LPCWSTR, LPCWSTR, DWORD, DWORD_PTR, IUri**);
74 static HRESULT (WINAPI *pCreateIUriBuilder)(IUri*, DWORD, DWORD_PTR, IUriBuilder**);
75 static HRESULT (WINAPI *pCoInternetCombineIUri)(IUri*,IUri*,DWORD,IUri**,DWORD_PTR);
76 static HRESULT (WINAPI *pCoInternetGetSession)(DWORD,IInternetSession**,DWORD);
77 static HRESULT (WINAPI *pCoInternetCombineUrlEx)(IUri*,LPCWSTR,DWORD,IUri**,DWORD_PTR);
78 static HRESULT (WINAPI *pCoInternetParseIUri)(IUri*,PARSEACTION,DWORD,LPWSTR,DWORD,DWORD*,DWORD_PTR);
79 static HRESULT (WINAPI *pCreateURLMonikerEx)(IMoniker*,LPCWSTR,IMoniker**,DWORD);
80 static HRESULT (WINAPI *pCreateURLMonikerEx2)(IMoniker*,IUri*,IMoniker**,DWORD);
81
82 static const WCHAR http_urlW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
83 '.','o','r','g','/',0};
84 static const WCHAR http_url_fragW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
85 '.','o','r','g','/','#','F','r','a','g',0};
86
87 static const WCHAR combine_baseW[] = {'w','i','n','e','t','e','s','t',':','?','t',
88 'e','s','t','i','n','g',0};
89 static const WCHAR combine_relativeW[] = {'?','t','e','s','t',0};
90 static const WCHAR combine_resultW[] = {'z','i','p',':','t','e','s','t',0};
91
92 static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0};
93
94 static const WCHAR parse_urlW[] = {'w','i','n','e','t','e','s','t',':','t','e','s','t',0};
95 static const WCHAR parse_resultW[] = {'z','i','p',':','t','e','s','t',0};
96
97 static PARSEACTION parse_action;
98 static DWORD parse_flags;
99
100 typedef struct _uri_create_flag_test {
101 DWORD flags;
102 HRESULT expected;
103 } uri_create_flag_test;
104
105 static const uri_create_flag_test invalid_flag_tests[] = {
106 /* Set of invalid flag combinations to test for. */
107 {Uri_CREATE_DECODE_EXTRA_INFO | Uri_CREATE_NO_DECODE_EXTRA_INFO, E_INVALIDARG},
108 {Uri_CREATE_CANONICALIZE | Uri_CREATE_NO_CANONICALIZE, E_INVALIDARG},
109 {Uri_CREATE_CRACK_UNKNOWN_SCHEMES | Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, E_INVALIDARG},
110 {Uri_CREATE_PRE_PROCESS_HTML_URI | Uri_CREATE_NO_PRE_PROCESS_HTML_URI, E_INVALIDARG},
111 {Uri_CREATE_IE_SETTINGS | Uri_CREATE_NO_IE_SETTINGS, E_INVALIDARG}
112 };
113
114 typedef struct _uri_str_property {
115 const char* value;
116 HRESULT expected;
117 BOOL todo;
118 const char* broken_value;
119 const char* value2;
120 HRESULT expected2;
121 } uri_str_property;
122
123 typedef struct _uri_dword_property {
124 DWORD value;
125 HRESULT expected;
126 BOOL todo;
127 BOOL broken_combine_hres;
128 } uri_dword_property;
129
130 typedef struct _uri_properties {
131 const char* uri;
132 DWORD create_flags;
133 HRESULT create_expected;
134 BOOL create_todo;
135
136 uri_str_property str_props[URI_STR_PROPERTY_COUNT];
137 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
138 } uri_properties;
139
140 static const uri_properties uri_tests[] = {
141 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK, FALSE,
142 {
143 {"http://www.winehq.org/",S_OK,FALSE}, /* ABSOLUTE_URI */
144 {"www.winehq.org",S_OK,FALSE}, /* AUTHORITY */
145 {"http://www.winehq.org/",S_OK,FALSE}, /* DISPLAY_URI */
146 {"winehq.org",S_OK,FALSE}, /* DOMAIN */
147 {"",S_FALSE,FALSE}, /* EXTENSION */
148 {"",S_FALSE,FALSE}, /* FRAGMENT */
149 {"www.winehq.org",S_OK,FALSE}, /* HOST */
150 {"",S_FALSE,FALSE}, /* PASSWORD */
151 {"/",S_OK,FALSE}, /* PATH */
152 {"/",S_OK,FALSE}, /* PATH_AND_QUERY */
153 {"",S_FALSE,FALSE}, /* QUERY */
154 {"http://www.winehq.org/tests/../tests/../..",S_OK,FALSE}, /* RAW_URI */
155 {"http",S_OK,FALSE}, /* SCHEME_NAME */
156 {"",S_FALSE,FALSE}, /* USER_INFO */
157 {"",S_FALSE,FALSE} /* USER_NAME */
158 },
159 {
160 {Uri_HOST_DNS,S_OK,FALSE}, /* HOST_TYPE */
161 {80,S_OK,FALSE}, /* PORT */
162 {URL_SCHEME_HTTP,S_OK,FALSE}, /* SCHEME */
163 {URLZONE_INVALID,E_NOTIMPL,FALSE} /* ZONE */
164 }
165 },
166 { "http://winehq.org/tests/.././tests", 0, S_OK, FALSE,
167 {
168 {"http://winehq.org/tests",S_OK,FALSE},
169 {"winehq.org",S_OK,FALSE},
170 {"http://winehq.org/tests",S_OK,FALSE},
171 {"winehq.org",S_OK,FALSE},
172 {"",S_FALSE,FALSE},
173 {"",S_FALSE,FALSE},
174 {"winehq.org",S_OK,FALSE},
175 {"",S_FALSE,FALSE},
176 {"/tests",S_OK,FALSE},
177 {"/tests",S_OK,FALSE},
178 {"",S_FALSE,FALSE},
179 {"http://winehq.org/tests/.././tests",S_OK,FALSE},
180 {"http",S_OK,FALSE},
181 {"",S_FALSE,FALSE},
182 {"",S_FALSE,FALSE}
183 },
184 {
185 {Uri_HOST_DNS,S_OK,FALSE},
186 {80,S_OK,FALSE},
187 {URL_SCHEME_HTTP,S_OK,FALSE},
188 {URLZONE_INVALID,E_NOTIMPL,FALSE}
189 }
190 },
191 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
192 {
193 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
194 {"www.winehq.org",S_OK,FALSE},
195 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
196 {"winehq.org",S_OK,FALSE},
197 {"",S_FALSE,FALSE},
198 {"",S_FALSE,FALSE},
199 {"www.winehq.org",S_OK,FALSE},
200 {"",S_FALSE,FALSE},
201 {"/",S_OK,FALSE},
202 {"/?query=x&return=y",S_OK,FALSE},
203 {"?query=x&return=y",S_OK,FALSE},
204 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
205 {"http",S_OK,FALSE},
206 {"",S_FALSE,FALSE},
207 {"",S_FALSE,FALSE}
208 },
209 {
210 {Uri_HOST_DNS,S_OK,FALSE},
211 {80,S_OK,FALSE},
212 {URL_SCHEME_HTTP,S_OK,FALSE},
213 {URLZONE_INVALID,E_NOTIMPL,FALSE},
214 }
215 },
216 { "HtTpS://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
217 {
218 {"https://www.winehq.org/?query=x&return=y",S_OK,FALSE},
219 {"www.winehq.org",S_OK,FALSE},
220 {"https://www.winehq.org/?query=x&return=y",S_OK,FALSE},
221 {"winehq.org",S_OK,FALSE},
222 {"",S_FALSE,FALSE},
223 {"",S_FALSE,FALSE},
224 {"www.winehq.org",S_OK,FALSE},
225 {"",S_FALSE,FALSE},
226 {"/",S_OK,FALSE},
227 {"/?query=x&return=y",S_OK,FALSE},
228 {"?query=x&return=y",S_OK,FALSE},
229 {"HtTpS://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
230 {"https",S_OK,FALSE},
231 {"",S_FALSE,FALSE},
232 {"",S_FALSE,FALSE}
233 },
234 {
235 {Uri_HOST_DNS,S_OK,FALSE},
236 {443,S_OK,FALSE},
237 {URL_SCHEME_HTTPS,S_OK,FALSE},
238 {URLZONE_INVALID,E_NOTIMPL,FALSE},
239 }
240 },
241 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK, FALSE,
242 {
243 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
244 {"usEr%3Ainfo@example.com",S_OK,FALSE},
245 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
246 {"example.com",S_OK,FALSE},
247 {"",S_FALSE,FALSE},
248 {"",S_FALSE,FALSE},
249 {"example.com",S_OK,FALSE},
250 {"",S_FALSE,FALSE},
251 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
252 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
253 {"",S_FALSE,FALSE},
254 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK,FALSE},
255 {"http",S_OK,FALSE},
256 {"usEr%3Ainfo",S_OK,FALSE},
257 {"usEr%3Ainfo",S_OK,FALSE}
258 },
259 {
260 {Uri_HOST_DNS,S_OK,FALSE},
261 {80,S_OK,FALSE},
262 {URL_SCHEME_HTTP,S_OK,FALSE},
263 {URLZONE_INVALID,E_NOTIMPL,FALSE},
264 }
265 },
266 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK, FALSE,
267 {
268 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
269 {"winepass:wine@ftp.winehq.org:9999",S_OK,FALSE},
270 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
271 {"winehq.org",S_OK,FALSE},
272 {".txt",S_OK,FALSE},
273 {"",S_FALSE,FALSE},
274 {"ftp.winehq.org",S_OK,FALSE},
275 {"wine",S_OK,FALSE},
276 {"/dir/foo%20bar.txt",S_OK,FALSE},
277 {"/dir/foo%20bar.txt",S_OK,FALSE},
278 {"",S_FALSE,FALSE},
279 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK,FALSE},
280 {"ftp",S_OK,FALSE},
281 {"winepass:wine",S_OK,FALSE},
282 {"winepass",S_OK,FALSE}
283 },
284 {
285 {Uri_HOST_DNS,S_OK,FALSE},
286 {9999,S_OK,FALSE},
287 {URL_SCHEME_FTP,S_OK,FALSE},
288 {URLZONE_INVALID,E_NOTIMPL,FALSE}
289 }
290 },
291 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK, FALSE,
292 {
293 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
294 {"",S_FALSE,FALSE},
295 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
296 {"",S_FALSE,FALSE},
297 {".mp3",S_OK,FALSE},
298 {"",S_FALSE,FALSE},
299 {"",S_FALSE,FALSE},
300 {"",S_FALSE,FALSE},
301 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
302 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
303 {"",S_FALSE,FALSE},
304 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
305 {"file",S_OK,FALSE},
306 {"",S_FALSE,FALSE},
307 {"",S_FALSE,FALSE}
308 },
309 {
310 {Uri_HOST_UNKNOWN,S_OK,FALSE},
311 {0,S_FALSE,FALSE},
312 {URL_SCHEME_FILE,S_OK,FALSE},
313 {URLZONE_INVALID,E_NOTIMPL,FALSE}
314 }
315 },
316 { "file://c:\\tests\\../tests/foo%20bar.mp3", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
317 {
318 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
319 {"",S_FALSE,FALSE},
320 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
321 {"",S_FALSE,FALSE},
322 {".mp3",S_OK,FALSE},
323 {"",S_FALSE,FALSE},
324 {"",S_FALSE,FALSE},
325 {"",S_FALSE,FALSE},
326 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
327 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
328 {"",S_FALSE,FALSE},
329 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
330 {"file",S_OK,FALSE},
331 {"",S_FALSE,FALSE},
332 {"",S_FALSE,FALSE}
333 },
334 {
335 {Uri_HOST_UNKNOWN,S_OK,FALSE},
336 {0,S_FALSE,FALSE},
337 {URL_SCHEME_FILE,S_OK,FALSE},
338 {URLZONE_INVALID,E_NOTIMPL,FALSE}
339 }
340 },
341 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK, FALSE,
342 {
343 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
344 {"",S_FALSE,FALSE},
345 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
346 {"",S_FALSE,FALSE},
347 {".txt",S_OK,FALSE},
348 {"",S_FALSE,FALSE},
349 {"",S_FALSE,FALSE},
350 {"",S_FALSE,FALSE},
351 {"/tests/test%20file.README.txt",S_OK,FALSE},
352 {"/tests/test%20file.README.txt",S_OK,FALSE},
353 {"",S_FALSE,FALSE},
354 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,FALSE},
355 {"file",S_OK,FALSE},
356 {"",S_FALSE,FALSE},
357 {"",S_FALSE,FALSE}
358 },
359 {
360 {Uri_HOST_UNKNOWN,S_OK,FALSE},
361 {0,S_FALSE,FALSE},
362 {URL_SCHEME_FILE,S_OK,FALSE},
363 {URLZONE_INVALID,E_NOTIMPL,FALSE}
364 }
365 },
366 { "file:///z:/test dir/README.txt", 0, S_OK, FALSE,
367 {
368 {"file:///z:/test%20dir/README.txt",S_OK},
369 {"",S_FALSE},
370 {"file:///z:/test%20dir/README.txt",S_OK},
371 {"",S_FALSE},
372 {".txt",S_OK},
373 {"",S_FALSE},
374 {"",S_FALSE},
375 {"",S_FALSE},
376 {"/z:/test%20dir/README.txt",S_OK},
377 {"/z:/test%20dir/README.txt",S_OK},
378 {"",S_FALSE},
379 {"file:///z:/test dir/README.txt",S_OK},
380 {"file",S_OK},
381 {"",S_FALSE},
382 {"",S_FALSE}
383 },
384 {
385 {Uri_HOST_UNKNOWN,S_OK,FALSE},
386 {0,S_FALSE,FALSE},
387 {URL_SCHEME_FILE,S_OK,FALSE},
388 {URLZONE_INVALID,E_NOTIMPL,FALSE}
389 }
390 },
391 { "file:///z:/test dir/README.txt#hash part", 0, S_OK, FALSE,
392 {
393 {"file:///z:/test%20dir/README.txt#hash%20part",S_OK},
394 {"",S_FALSE},
395 {"file:///z:/test%20dir/README.txt#hash%20part",S_OK},
396 {"",S_FALSE},
397 {".txt#hash%20part",S_OK},
398 {"",S_FALSE},
399 {"",S_FALSE},
400 {"",S_FALSE},
401 {"/z:/test%20dir/README.txt#hash%20part",S_OK},
402 {"/z:/test%20dir/README.txt#hash%20part",S_OK},
403 {"",S_FALSE},
404 {"file:///z:/test dir/README.txt#hash part",S_OK},
405 {"file",S_OK},
406 {"",S_FALSE},
407 {"",S_FALSE}
408 },
409 {
410 {Uri_HOST_UNKNOWN,S_OK,FALSE},
411 {0,S_FALSE,FALSE},
412 {URL_SCHEME_FILE,S_OK,FALSE},
413 {URLZONE_INVALID,E_NOTIMPL,FALSE}
414 }
415 },
416 { "urn:nothing:should:happen here", 0, S_OK, FALSE,
417 {
418 {"urn:nothing:should:happen here",S_OK,FALSE},
419 {"",S_FALSE,FALSE},
420 {"urn:nothing:should:happen here",S_OK,FALSE},
421 {"",S_FALSE,FALSE},
422 {"",S_FALSE,FALSE},
423 {"",S_FALSE,FALSE},
424 {"",S_FALSE,FALSE},
425 {"",S_FALSE,FALSE},
426 {"nothing:should:happen here",S_OK,FALSE},
427 {"nothing:should:happen here",S_OK,FALSE},
428 {"",S_FALSE,FALSE},
429 {"urn:nothing:should:happen here",S_OK,FALSE},
430 {"urn",S_OK,FALSE},
431 {"",S_FALSE,FALSE},
432 {"",S_FALSE,FALSE}
433 },
434 {
435 {Uri_HOST_UNKNOWN,S_OK,FALSE},
436 {0,S_FALSE,FALSE},
437 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
438 {URLZONE_INVALID,E_NOTIMPL,FALSE}
439 }
440 },
441 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK, FALSE,
442 {
443 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
444 {"127.0.0.1",S_OK,FALSE},
445 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
446 {"",S_FALSE,FALSE},
447 {".txt",S_OK,FALSE},
448 {"",S_FALSE,FALSE},
449 {"127.0.0.1",S_OK,FALSE},
450 {"",S_FALSE,FALSE},
451 {"/test%20dir/test.txt",S_OK,FALSE},
452 {"/test%20dir/test.txt",S_OK,FALSE},
453 {"",S_FALSE,FALSE},
454 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
455 {"http",S_OK,FALSE},
456 {"",S_FALSE,FALSE},
457 {"",S_FALSE,FALSE}
458 },
459 {
460 {Uri_HOST_IPV4,S_OK,FALSE},
461 {80,S_OK,FALSE},
462 {URL_SCHEME_HTTP,S_OK,FALSE},
463 {URLZONE_INVALID,E_NOTIMPL,FALSE}
464 }
465 },
466 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK, FALSE,
467 {
468 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
469 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,FALSE},
470 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
471 {"",S_FALSE,FALSE},
472 {"",S_FALSE,FALSE},
473 {"",S_FALSE,FALSE},
474 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,FALSE},
475 {"",S_FALSE,FALSE},
476 {"/",S_OK,FALSE},
477 {"/",S_OK,FALSE},
478 {"",S_FALSE,FALSE},
479 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
480 {"http",S_OK,FALSE},
481 {"",S_FALSE,FALSE},
482 {"",S_FALSE,FALSE}
483 },
484 {
485 {Uri_HOST_IPV6,S_OK,FALSE},
486 {80,S_OK,FALSE},
487 {URL_SCHEME_HTTP,S_OK,FALSE},
488 {URLZONE_INVALID,E_NOTIMPL,FALSE}
489 }
490 },
491 { "ftp://[::13.1.68.3]", 0, S_OK, FALSE,
492 {
493 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
494 {"[::13.1.68.3]",S_OK,FALSE},
495 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
496 {"",S_FALSE,FALSE},
497 {"",S_FALSE,FALSE},
498 {"",S_FALSE,FALSE},
499 {"::13.1.68.3",S_OK,FALSE},
500 {"",S_FALSE,FALSE},
501 {"/",S_OK,FALSE},
502 {"/",S_OK,FALSE},
503 {"",S_FALSE,FALSE},
504 {"ftp://[::13.1.68.3]",S_OK,FALSE},
505 {"ftp",S_OK,FALSE},
506 {"",S_FALSE,FALSE},
507 {"",S_FALSE,FALSE}
508 },
509 {
510 {Uri_HOST_IPV6,S_OK,FALSE},
511 {21,S_OK,FALSE},
512 {URL_SCHEME_FTP,S_OK,FALSE},
513 {URLZONE_INVALID,E_NOTIMPL,FALSE}
514 }
515 },
516 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK, FALSE,
517 {
518 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
519 {"[fedc:ba98::3210]",S_OK,FALSE},
520 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
521 {"",S_FALSE,FALSE},
522 {"",S_FALSE,FALSE},
523 {"",S_FALSE,FALSE},
524 {"fedc:ba98::3210",S_OK,FALSE},
525 {"",S_FALSE,FALSE},
526 {"/",S_OK,FALSE},
527 {"/",S_OK,FALSE},
528 {"",S_FALSE,FALSE},
529 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
530 {"http",S_OK,FALSE},
531 {"",S_FALSE,FALSE},
532 {"",S_FALSE,FALSE},
533 },
534 {
535 {Uri_HOST_IPV6,S_OK,FALSE},
536 {80,S_OK,FALSE},
537 {URL_SCHEME_HTTP,S_OK,FALSE},
538 {URLZONE_INVALID,E_NOTIMPL,FALSE}
539 }
540 },
541 { "1234://www.winehq.org", 0, S_OK, FALSE,
542 {
543 {"1234://www.winehq.org/",S_OK,FALSE},
544 {"www.winehq.org",S_OK,FALSE},
545 {"1234://www.winehq.org/",S_OK,FALSE},
546 {"winehq.org",S_OK,FALSE},
547 {"",S_FALSE,FALSE},
548 {"",S_FALSE,FALSE},
549 {"www.winehq.org",S_OK,FALSE},
550 {"",S_FALSE,FALSE},
551 {"/",S_OK,FALSE},
552 {"/",S_OK,FALSE},
553 {"",S_FALSE,FALSE},
554 {"1234://www.winehq.org",S_OK,FALSE},
555 {"1234",S_OK,FALSE},
556 {"",S_FALSE,FALSE},
557 {"",S_FALSE,FALSE}
558 },
559 {
560 {Uri_HOST_DNS,S_OK,FALSE},
561 {0,S_FALSE,FALSE},
562 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
563 {URLZONE_INVALID,E_NOTIMPL,FALSE}
564 }
565 },
566 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
567 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
568 {
569 {"file:///C:/test/test.mp3",S_OK,FALSE},
570 {"",S_FALSE,FALSE},
571 {"file:///C:/test/test.mp3",S_OK,FALSE},
572 {"",S_FALSE,FALSE},
573 {".mp3",S_OK,FALSE},
574 {"",S_FALSE,FALSE},
575 {"",S_FALSE,FALSE},
576 {"",S_FALSE,FALSE},
577 {"/C:/test/test.mp3",S_OK,FALSE},
578 {"/C:/test/test.mp3",S_OK,FALSE},
579 {"",S_FALSE,FALSE},
580 {"C:/test/test.mp3",S_OK,FALSE},
581 {"file",S_OK,FALSE},
582 {"",S_FALSE,FALSE},
583 {"",S_FALSE,FALSE}
584 },
585 {
586 {Uri_HOST_UNKNOWN,S_OK,FALSE},
587 {0,S_FALSE,FALSE},
588 {URL_SCHEME_FILE,S_OK,FALSE},
589 {URLZONE_INVALID,E_NOTIMPL,FALSE}
590 }
591 },
592 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
593 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
594 {
595 {"file://server/test.mp3",S_OK,FALSE},
596 {"server",S_OK,FALSE},
597 {"file://server/test.mp3",S_OK,FALSE},
598 {"",S_FALSE,FALSE},
599 {".mp3",S_OK,FALSE},
600 {"",S_FALSE,FALSE},
601 {"server",S_OK,FALSE},
602 {"",S_FALSE,FALSE},
603 {"/test.mp3",S_OK,FALSE},
604 {"/test.mp3",S_OK,FALSE},
605 {"",S_FALSE,FALSE},
606 {"\\\\Server/test.mp3",S_OK,FALSE},
607 {"file",S_OK,FALSE},
608 {"",S_FALSE,FALSE},
609 {"",S_FALSE,FALSE}
610 },
611 {
612 {Uri_HOST_DNS,S_OK,FALSE},
613 {0,S_FALSE,FALSE},
614 {URL_SCHEME_FILE,S_OK,FALSE},
615 {URLZONE_INVALID,E_NOTIMPL,FALSE}
616 }
617 },
618 { "C:/test/test.mp3#fragment|part", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME|Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
619 {
620 {"file://C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
621 {"",S_FALSE,FALSE},
622 {"file://C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
623 {"",S_FALSE,FALSE},
624 {".mp3#fragment|part",S_OK,FALSE},
625 {"",S_FALSE,FALSE},
626 {"",S_FALSE,FALSE},
627 {"",S_FALSE,FALSE},
628 {"C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
629 {"C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
630 {"",S_FALSE,FALSE},
631 {"C:/test/test.mp3#fragment|part",S_OK,FALSE},
632 {"file",S_OK,FALSE},
633 {"",S_FALSE,FALSE},
634 {"",S_FALSE,FALSE}
635 },
636 {
637 {Uri_HOST_UNKNOWN,S_OK,FALSE},
638 {0,S_FALSE,FALSE},
639 {URL_SCHEME_FILE,S_OK,FALSE},
640 {URLZONE_INVALID,E_NOTIMPL,FALSE}
641 }
642 },
643 { "C:/test/test.mp3?query|part", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME|Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
644 {
645 {"file://C:\\test\\test.mp3?query|part",S_OK,FALSE},
646 {"",S_FALSE,FALSE},
647 {"file://C:\\test\\test.mp3?query|part",S_OK,FALSE},
648 {"",S_FALSE,FALSE},
649 {".mp3",S_OK,FALSE},
650 {"",S_FALSE,FALSE},
651 {"",S_FALSE,FALSE},
652 {"",S_FALSE,FALSE},
653 {"C:\\test\\test.mp3",S_OK,FALSE},
654 {"C:\\test\\test.mp3?query|part",S_OK,FALSE},
655 {"?query|part",S_OK,FALSE},
656 {"C:/test/test.mp3?query|part",S_OK,FALSE},
657 {"file",S_OK,FALSE},
658 {"",S_FALSE,FALSE},
659 {"",S_FALSE,FALSE}
660 },
661 {
662 {Uri_HOST_UNKNOWN,S_OK,FALSE},
663 {0,S_FALSE,FALSE},
664 {URL_SCHEME_FILE,S_OK,FALSE},
665 {URLZONE_INVALID,E_NOTIMPL,FALSE}
666 }
667 },
668 { "C:/test/test.mp3?query|part#hash|part", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME|Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
669 {
670 {"file://C:\\test\\test.mp3?query|part#hash|part",S_OK,FALSE},
671 {"",S_FALSE,FALSE},
672 {"file://C:\\test\\test.mp3?query|part#hash|part",S_OK,FALSE},
673 {"",S_FALSE,FALSE},
674 {".mp3",S_OK,FALSE},
675 {"#hash|part",S_OK,FALSE},
676 {"",S_FALSE,FALSE},
677 {"",S_FALSE,FALSE},
678 {"C:\\test\\test.mp3",S_OK,FALSE},
679 {"C:\\test\\test.mp3?query|part",S_OK,FALSE},
680 {"?query|part",S_OK,FALSE},
681 {"C:/test/test.mp3?query|part#hash|part",S_OK,FALSE},
682 {"file",S_OK,FALSE},
683 {"",S_FALSE,FALSE},
684 {"",S_FALSE,FALSE}
685 },
686 {
687 {Uri_HOST_UNKNOWN,S_OK,FALSE},
688 {0,S_FALSE,FALSE},
689 {URL_SCHEME_FILE,S_OK,FALSE},
690 {URLZONE_INVALID,E_NOTIMPL,FALSE}
691 }
692 },
693 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
694 {
695 {"*:www.winehq.org/test",S_OK,FALSE},
696 {"www.winehq.org",S_OK,FALSE},
697 {"*:www.winehq.org/test",S_OK,FALSE},
698 {"winehq.org",S_OK,FALSE},
699 {"",S_FALSE,FALSE},
700 {"",S_FALSE,FALSE},
701 {"www.winehq.org",S_OK,FALSE},
702 {"",S_FALSE,FALSE},
703 {"/test",S_OK,FALSE},
704 {"/test",S_OK,FALSE},
705 {"",S_FALSE,FALSE},
706 {"www.winehq.org/test",S_OK,FALSE},
707 {"*",S_OK,FALSE},
708 {"",S_FALSE,FALSE},
709 {"",S_FALSE,FALSE}
710 },
711 {
712 {Uri_HOST_DNS,S_OK,FALSE},
713 {0,S_FALSE,FALSE},
714 {URL_SCHEME_WILDCARD,S_OK,FALSE},
715 {URLZONE_INVALID,E_NOTIMPL,FALSE}
716 }
717 },
718 /* Valid since the '*' is the only character in the scheme name. */
719 { "*:www.winehq.org/test", 0, S_OK, FALSE,
720 {
721 {"*:www.winehq.org/test",S_OK,FALSE},
722 {"www.winehq.org",S_OK,FALSE},
723 {"*:www.winehq.org/test",S_OK,FALSE},
724 {"winehq.org",S_OK,FALSE},
725 {"",S_FALSE,FALSE},
726 {"",S_FALSE,FALSE},
727 {"www.winehq.org",S_OK,FALSE},
728 {"",S_FALSE,FALSE},
729 {"/test",S_OK,FALSE},
730 {"/test",S_OK,FALSE},
731 {"",S_FALSE,FALSE},
732 {"*:www.winehq.org/test",S_OK,FALSE},
733 {"*",S_OK,FALSE},
734 {"",S_FALSE,FALSE},
735 {"",S_FALSE,FALSE}
736 },
737 {
738 {Uri_HOST_DNS,S_OK,FALSE},
739 {0,S_FALSE,FALSE},
740 {URL_SCHEME_WILDCARD,S_OK,FALSE},
741 {URLZONE_INVALID,E_NOTIMPL,FALSE}
742 }
743 },
744 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
745 {
746 {"/../some dir/test.ext",S_OK,FALSE},
747 {"",S_FALSE,FALSE},
748 {"/../some dir/test.ext",S_OK,FALSE},
749 {"",S_FALSE,FALSE},
750 {".ext",S_OK,FALSE},
751 {"",S_FALSE,FALSE},
752 {"",S_FALSE,FALSE},
753 {"",S_FALSE,FALSE},
754 {"/../some dir/test.ext",S_OK,FALSE},
755 {"/../some dir/test.ext",S_OK,FALSE},
756 {"",S_FALSE,FALSE},
757 {"/../some dir/test.ext",S_OK,FALSE},
758 {"",S_FALSE,FALSE},
759 {"",S_FALSE,FALSE},
760 {"",S_FALSE,FALSE}
761 },
762 {
763 {Uri_HOST_UNKNOWN,S_OK,FALSE},
764 {0,S_FALSE,FALSE},
765 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
766 {URLZONE_INVALID,E_NOTIMPL,FALSE}
767 }
768 },
769 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
770 {
771 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
772 {"",S_OK,FALSE},
773 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
774 {"",S_FALSE,FALSE},
775 {"",S_FALSE,FALSE},
776 {"",S_FALSE,FALSE},
777 {"",S_OK,FALSE},
778 {"",S_FALSE,FALSE},
779 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
780 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
781 {"",S_FALSE,FALSE},
782 {"//implicit/wildcard/uri scheme",S_OK,FALSE},
783 {"*",S_OK,FALSE},
784 {"",S_FALSE,FALSE},
785 {"",S_FALSE,FALSE},
786 },
787 {
788 {Uri_HOST_UNKNOWN,S_OK,FALSE},
789 {0,S_FALSE,FALSE},
790 {URL_SCHEME_WILDCARD,S_OK,FALSE},
791 {URLZONE_INVALID,E_NOTIMPL,FALSE}
792 }
793 },
794 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and it's an unknown scheme. */
795 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, S_OK, FALSE,
796 {
797 {"zip:/.//google.com",S_OK,FALSE},
798 {"",S_FALSE,FALSE},
799 {"zip:/.//google.com",S_OK,FALSE},
800 {"",S_FALSE,FALSE},
801 {".com",S_OK,FALSE},
802 {"",S_FALSE,FALSE},
803 {"",S_FALSE,FALSE},
804 {"",S_FALSE,FALSE},
805 {"/.//google.com",S_OK,FALSE},
806 {"/.//google.com",S_OK,FALSE},
807 {"",S_FALSE,FALSE},
808 {"zip://google.com",S_OK,FALSE},
809 {"zip",S_OK,FALSE},
810 {"",S_FALSE,FALSE},
811 {"",S_FALSE,FALSE}
812 },
813 {
814 {Uri_HOST_UNKNOWN,S_OK,FALSE},
815 {0,S_FALSE,FALSE},
816 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
817 {URLZONE_INVALID,E_NOTIMPL,FALSE}
818 }
819 },
820 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
821 { "ftp://user:pass:word@winehq.org/", 0, S_OK, FALSE,
822 {
823 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
824 {"user:pass:word@winehq.org",S_OK,FALSE},
825 {"ftp://winehq.org/",S_OK,FALSE},
826 {"winehq.org",S_OK,FALSE},
827 {"",S_FALSE,FALSE},
828 {"",S_FALSE,FALSE},
829 {"winehq.org",S_OK,FALSE},
830 {"pass:word",S_OK,FALSE},
831 {"/",S_OK,FALSE},
832 {"/",S_OK,FALSE},
833 {"",S_FALSE,FALSE},
834 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
835 {"ftp",S_OK,FALSE},
836 {"user:pass:word",S_OK,FALSE},
837 {"user",S_OK,FALSE}
838 },
839 {
840 {Uri_HOST_DNS,S_OK,FALSE},
841 {21,S_OK,FALSE},
842 {URL_SCHEME_FTP,S_OK,FALSE},
843 {URLZONE_INVALID,E_NOTIMPL,FALSE}
844 }
845 },
846 /* Make sure % encoded unreserved characters are decoded. */
847 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK, FALSE,
848 {
849 {"ftp://wINe:PASS@ftp.google.com/",S_OK,FALSE},
850 {"wINe:PASS@ftp.google.com",S_OK,FALSE},
851 {"ftp://ftp.google.com/",S_OK,FALSE},
852 {"google.com",S_OK,FALSE},
853 {"",S_FALSE,FALSE},
854 {"",S_FALSE,FALSE},
855 {"ftp.google.com",S_OK,FALSE},
856 {"PASS",S_OK,FALSE},
857 {"/",S_OK,FALSE},
858 {"/",S_OK,FALSE},
859 {"",S_FALSE,FALSE},
860 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK,FALSE},
861 {"ftp",S_OK,FALSE},
862 {"wINe:PASS",S_OK,FALSE},
863 {"wINe",S_OK,FALSE}
864 },
865 {
866 {Uri_HOST_DNS,S_OK,FALSE},
867 {21,S_OK,FALSE},
868 {URL_SCHEME_FTP,S_OK,FALSE},
869 {URLZONE_INVALID,E_NOTIMPL,FALSE}
870 }
871 },
872 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
873 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK, FALSE,
874 {
875 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
876 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK,FALSE},
877 {"ftp://ftp.google.com/",S_OK,FALSE},
878 {"google.com",S_OK,FALSE},
879 {"",S_FALSE,FALSE},
880 {"",S_FALSE,FALSE},
881 {"ftp.google.com",S_OK,FALSE},
882 {"PA%7B%7D",S_OK,FALSE},
883 {"/",S_OK,FALSE},
884 {"/",S_OK,FALSE},
885 {"",S_FALSE,FALSE},
886 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
887 {"ftp",S_OK,FALSE},
888 {"w%5D%5Be:PA%7B%7D",S_OK,FALSE},
889 {"w%5D%5Be",S_OK,FALSE}
890 },
891 {
892 {Uri_HOST_DNS,S_OK,FALSE},
893 {21,S_OK,FALSE},
894 {URL_SCHEME_FTP,S_OK,FALSE},
895 {URLZONE_INVALID,E_NOTIMPL,FALSE}
896 }
897 },
898 /* You're allowed to have an empty password portion in the userinfo section. */
899 { "ftp://empty:@ftp.google.com/", 0, S_OK, FALSE,
900 {
901 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
902 {"empty:@ftp.google.com",S_OK,FALSE},
903 {"ftp://ftp.google.com/",S_OK,FALSE},
904 {"google.com",S_OK,FALSE},
905 {"",S_FALSE,FALSE},
906 {"",S_FALSE,FALSE},
907 {"ftp.google.com",S_OK,FALSE},
908 {"",S_OK,FALSE},
909 {"/",S_OK,FALSE},
910 {"/",S_OK,FALSE},
911 {"",S_FALSE,FALSE},
912 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
913 {"ftp",S_OK,FALSE},
914 {"empty:",S_OK,FALSE},
915 {"empty",S_OK,FALSE}
916 },
917 {
918 {Uri_HOST_DNS,S_OK,FALSE},
919 {21,S_OK,FALSE},
920 {URL_SCHEME_FTP,S_OK,FALSE},
921 {URLZONE_INVALID,E_NOTIMPL,FALSE}
922 }
923 },
924 /* Make sure forbidden characters in "userinfo" get encoded. */
925 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK, FALSE,
926 {
927 {"ftp://%22%20%22weird@ftp.google.com/",S_OK,FALSE},
928 {"%22%20%22weird@ftp.google.com",S_OK,FALSE},
929 {"ftp://ftp.google.com/",S_OK,FALSE},
930 {"google.com",S_OK,FALSE},
931 {"",S_FALSE,FALSE},
932 {"",S_FALSE,FALSE},
933 {"ftp.google.com",S_OK,FALSE},
934 {"",S_FALSE,FALSE},
935 {"/",S_OK,FALSE},
936 {"/",S_OK,FALSE},
937 {"",S_FALSE,FALSE},
938 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
939 {"ftp",S_OK,FALSE},
940 {"%22%20%22weird",S_OK,FALSE},
941 {"%22%20%22weird",S_OK,FALSE}
942 },
943 {
944 {Uri_HOST_DNS,S_OK,FALSE},
945 {21,S_OK,FALSE},
946 {URL_SCHEME_FTP,S_OK,FALSE},
947 {URLZONE_INVALID,E_NOTIMPL,FALSE}
948 }
949 },
950 /* Make sure the forbidden characters don't get percent encoded. */
951 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
952 {
953 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
954 {"\" \"weird@ftp.google.com",S_OK,FALSE},
955 {"ftp://ftp.google.com/",S_OK,FALSE},
956 {"google.com",S_OK,FALSE},
957 {"",S_FALSE,FALSE},
958 {"",S_FALSE,FALSE},
959 {"ftp.google.com",S_OK,FALSE},
960 {"",S_FALSE,FALSE},
961 {"/",S_OK,FALSE},
962 {"/",S_OK,FALSE},
963 {"",S_FALSE,FALSE},
964 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
965 {"ftp",S_OK,FALSE},
966 {"\" \"weird",S_OK,FALSE},
967 {"\" \"weird",S_OK,FALSE}
968 },
969 {
970 {Uri_HOST_DNS,S_OK,FALSE},
971 {21,S_OK,FALSE},
972 {URL_SCHEME_FTP,S_OK,FALSE},
973 {URLZONE_INVALID,E_NOTIMPL,FALSE}
974 }
975 },
976 /* Make sure already percent encoded characters don't get unencoded. */
977 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
978 {
979 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
980 {"\"%20\"weird@ftp.google.com",S_OK,FALSE},
981 {"ftp://ftp.google.com/\"%20\"weird",S_OK,FALSE},
982 {"google.com",S_OK,FALSE},
983 {"",S_FALSE,FALSE},
984 {"",S_FALSE,FALSE},
985 {"ftp.google.com",S_OK,FALSE},
986 {"",S_FALSE,FALSE},
987 {"/\"%20\"weird",S_OK,FALSE},
988 {"/\"%20\"weird",S_OK,FALSE},
989 {"",S_FALSE,FALSE},
990 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
991 {"ftp",S_OK,FALSE},
992 {"\"%20\"weird",S_OK,FALSE},
993 {"\"%20\"weird",S_OK,FALSE}
994 },
995 {
996 {Uri_HOST_DNS,S_OK,FALSE},
997 {21,S_OK,FALSE},
998 {URL_SCHEME_FTP,S_OK,FALSE},
999 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1000 }
1001 },
1002 /* Allowed to have invalid % encoded because it's an unknown scheme type. */
1003 { "zip://%xy:word@winehq.org/", 0, S_OK, FALSE,
1004 {
1005 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
1006 {"%xy:word@winehq.org",S_OK,FALSE},
1007 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
1008 {"winehq.org",S_OK,FALSE},
1009 {"",S_FALSE,FALSE},
1010 {"",S_FALSE,FALSE},
1011 {"winehq.org",S_OK,FALSE},
1012 {"word",S_OK,FALSE},
1013 {"/",S_OK,FALSE},
1014 {"/",S_OK,FALSE},
1015 {"",S_FALSE,FALSE},
1016 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
1017 {"zip",S_OK,FALSE},
1018 {"%xy:word",S_OK,FALSE},
1019 {"%xy",S_OK,FALSE}
1020 },
1021 {
1022 {Uri_HOST_DNS,S_OK,FALSE},
1023 {0,S_FALSE,FALSE},
1024 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1025 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1026 }
1027 },
1028 /* Unreserved, percent encoded characters aren't decoded in the userinfo because the scheme
1029 * isn't known.
1030 */
1031 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK, FALSE,
1032 {
1033 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
1034 {"%2E:%52%53ord@winehq.org",S_OK,FALSE},
1035 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
1036 {"winehq.org",S_OK,FALSE},
1037 {"",S_FALSE,FALSE},
1038 {"",S_FALSE,FALSE},
1039 {"winehq.org",S_OK,FALSE},
1040 {"%52%53ord",S_OK,FALSE},
1041 {"/",S_OK,FALSE},
1042 {"/",S_OK,FALSE},
1043 {"",S_FALSE,FALSE},
1044 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
1045 {"zip",S_OK,FALSE},
1046 {"%2E:%52%53ord",S_OK,FALSE},
1047 {"%2E",S_OK,FALSE}
1048 },
1049 {
1050 {Uri_HOST_DNS,S_OK,FALSE},
1051 {0,S_FALSE,FALSE},
1052 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1053 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1054 }
1055 },
1056 { "ftp://[](),'test':word@winehq.org/", 0, S_OK, FALSE,
1057 {
1058 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
1059 {"[](),'test':word@winehq.org",S_OK,FALSE},
1060 {"ftp://winehq.org/",S_OK,FALSE},
1061 {"winehq.org",S_OK,FALSE},
1062 {"",S_FALSE,FALSE},
1063 {"",S_FALSE,FALSE},
1064 {"winehq.org",S_OK,FALSE},
1065 {"word",S_OK,FALSE},
1066 {"/",S_OK,FALSE},
1067 {"/",S_OK,FALSE},
1068 {"",S_FALSE,FALSE},
1069 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
1070 {"ftp",S_OK,FALSE},
1071 {"[](),'test':word",S_OK,FALSE},
1072 {"[](),'test'",S_OK,FALSE}
1073 },
1074 {
1075 {Uri_HOST_DNS,S_OK,FALSE},
1076 {21,S_OK,FALSE},
1077 {URL_SCHEME_FTP,S_OK,FALSE},
1078 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1079 }
1080 },
1081 { "ftp://test?:word@winehq.org/", 0, S_OK, FALSE,
1082 {
1083 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
1084 {"test",S_OK,FALSE},
1085 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
1086 {"",S_FALSE,FALSE},
1087 {"",S_FALSE,FALSE},
1088 {"",S_FALSE,FALSE},
1089 {"test",S_OK,FALSE},
1090 {"",S_FALSE,FALSE},
1091 {"/",S_OK,FALSE},
1092 {"/?:word@winehq.org/",S_OK,FALSE},
1093 {"?:word@winehq.org/",S_OK,FALSE},
1094 {"ftp://test?:word@winehq.org/",S_OK,FALSE},
1095 {"ftp",S_OK,FALSE},
1096 {"",S_FALSE,FALSE},
1097 {"",S_FALSE,FALSE}
1098 },
1099 {
1100 {Uri_HOST_DNS,S_OK,FALSE},
1101 {21,S_OK,FALSE},
1102 {URL_SCHEME_FTP,S_OK,FALSE},
1103 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1104 }
1105 },
1106 { "ftp://test#:word@winehq.org/", 0, S_OK, FALSE,
1107 {
1108 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
1109 {"test",S_OK,FALSE},
1110 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
1111 {"",S_FALSE,FALSE},
1112 {"",S_FALSE,FALSE},
1113 {"#:word@winehq.org/",S_OK,FALSE},
1114 {"test",S_OK,FALSE},
1115 {"",S_FALSE,FALSE},
1116 {"/",S_OK,FALSE},
1117 {"/",S_OK,FALSE},
1118 {"",S_FALSE,FALSE},
1119 {"ftp://test#:word@winehq.org/",S_OK,FALSE},
1120 {"ftp",S_OK,FALSE},
1121 {"",S_FALSE,FALSE},
1122 {"",S_FALSE,FALSE}
1123 },
1124 {
1125 {Uri_HOST_DNS,S_OK,FALSE},
1126 {21,S_OK,FALSE},
1127 {URL_SCHEME_FTP,S_OK,FALSE},
1128 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1129 }
1130 },
1131 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
1132 { "zip://test\\:word@winehq.org/", 0, S_OK, FALSE,
1133 {
1134 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1135 {"test\\:word@winehq.org",S_OK,FALSE},
1136 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1137 {"winehq.org",S_OK,FALSE},
1138 {"",S_FALSE,FALSE},
1139 {"",S_FALSE,FALSE},
1140 {"winehq.org",S_OK,FALSE},
1141 {"word",S_OK,FALSE},
1142 {"/",S_OK,FALSE},
1143 {"/",S_OK,FALSE},
1144 {"",S_FALSE,FALSE},
1145 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1146 {"zip",S_OK,FALSE},
1147 {"test\\:word",S_OK,FALSE},
1148 {"test\\",S_OK,FALSE}
1149 },
1150 {
1151 {Uri_HOST_DNS,S_OK,FALSE},
1152 {0,S_FALSE,FALSE},
1153 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1154 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1155 }
1156 },
1157 /* It normalizes IPv4 addresses correctly. */
1158 { "http://127.000.000.100/", 0, S_OK, FALSE,
1159 {
1160 {"http://127.0.0.100/",S_OK,FALSE},
1161 {"127.0.0.100",S_OK,FALSE},
1162 {"http://127.0.0.100/",S_OK,FALSE},
1163 {"",S_FALSE,FALSE},
1164 {"",S_FALSE,FALSE},
1165 {"",S_FALSE,FALSE},
1166 {"127.0.0.100",S_OK,FALSE},
1167 {"",S_FALSE,FALSE},
1168 {"/",S_OK,FALSE},
1169 {"/",S_OK,FALSE},
1170 {"",S_FALSE,FALSE},
1171 {"http://127.000.000.100/",S_OK,FALSE},
1172 {"http",S_OK,FALSE},
1173 {"",S_FALSE,FALSE},
1174 {"",S_FALSE,FALSE}
1175 },
1176 {
1177 {Uri_HOST_IPV4,S_OK,FALSE},
1178 {80,S_OK,FALSE},
1179 {URL_SCHEME_HTTP,S_OK,FALSE},
1180 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1181 }
1182 },
1183 { "http://127.0.0.1:8000", 0, S_OK, FALSE,
1184 {
1185 {"http://127.0.0.1:8000/",S_OK},
1186 {"127.0.0.1:8000",S_OK},
1187 {"http://127.0.0.1:8000/",S_OK},
1188 {"",S_FALSE},
1189 {"",S_FALSE},
1190 {"",S_FALSE},
1191 {"127.0.0.1",S_OK},
1192 {"",S_FALSE},
1193 {"/",S_OK},
1194 {"/",S_OK},
1195 {"",S_FALSE},
1196 {"http://127.0.0.1:8000",S_OK},
1197 {"http",S_OK},
1198 {"",S_FALSE},
1199 {"",S_FALSE}
1200 },
1201 {
1202 {Uri_HOST_IPV4,S_OK,FALSE},
1203 {8000,S_OK,FALSE},
1204 {URL_SCHEME_HTTP,S_OK,FALSE},
1205 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1206 }
1207 },
1208 /* Make sure it normalizes partial IPv4 addresses correctly. */
1209 { "http://127.0/", 0, S_OK, FALSE,
1210 {
1211 {"http://127.0.0.0/",S_OK,FALSE},
1212 {"127.0.0.0",S_OK,FALSE},
1213 {"http://127.0.0.0/",S_OK,FALSE},
1214 {"",S_FALSE,FALSE},
1215 {"",S_FALSE,FALSE},
1216 {"",S_FALSE,FALSE},
1217 {"127.0.0.0",S_OK,FALSE},
1218 {"",S_FALSE,FALSE},
1219 {"/",S_OK,FALSE},
1220 {"/",S_OK,FALSE},
1221 {"",S_FALSE,FALSE},
1222 {"http://127.0/",S_OK,FALSE},
1223 {"http",S_OK,FALSE},
1224 {"",S_FALSE,FALSE},
1225 {"",S_FALSE,FALSE}
1226 },
1227 {
1228 {Uri_HOST_IPV4,S_OK,FALSE},
1229 {80,S_OK,FALSE},
1230 {URL_SCHEME_HTTP,S_OK,FALSE},
1231 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1232 }
1233 },
1234 /* Make sure it converts implicit IPv4's correctly. */
1235 { "http://123456/", 0, S_OK, FALSE,
1236 {
1237 {"http://0.1.226.64/",S_OK,FALSE},
1238 {"0.1.226.64",S_OK,FALSE},
1239 {"http://0.1.226.64/",S_OK,FALSE},
1240 {"",S_FALSE,FALSE},
1241 {"",S_FALSE,FALSE},
1242 {"",S_FALSE,FALSE},
1243 {"0.1.226.64",S_OK,FALSE},
1244 {"",S_FALSE,FALSE},
1245 {"/",S_OK,FALSE},
1246 {"/",S_OK,FALSE},
1247 {"",S_FALSE,FALSE},
1248 {"http://123456/",S_OK,FALSE},
1249 {"http",S_OK,FALSE},
1250 {"",S_FALSE,FALSE},
1251 {"",S_FALSE,FALSE}
1252 },
1253 {
1254 {Uri_HOST_IPV4,S_OK,FALSE},
1255 {80,S_OK,FALSE},
1256 {URL_SCHEME_HTTP,S_OK,FALSE},
1257 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1258 }
1259 },
1260 /* UINT_MAX */
1261 { "http://4294967295/", 0, S_OK, FALSE,
1262 {
1263 {"http://255.255.255.255/",S_OK,FALSE},
1264 {"255.255.255.255",S_OK,FALSE},
1265 {"http://255.255.255.255/",S_OK,FALSE},
1266 {"",S_FALSE,FALSE},
1267 {"",S_FALSE,FALSE},
1268 {"",S_FALSE,FALSE},
1269 {"255.255.255.255",S_OK,FALSE},
1270 {"",S_FALSE,FALSE},
1271 {"/",S_OK,FALSE},
1272 {"/",S_OK,FALSE},
1273 {"",S_FALSE,FALSE},
1274 {"http://4294967295/",S_OK,FALSE},
1275 {"http",S_OK,FALSE},
1276 {"",S_FALSE,FALSE},
1277 {"",S_FALSE,FALSE}
1278 },
1279 {
1280 {Uri_HOST_IPV4,S_OK,FALSE},
1281 {80,S_OK,FALSE},
1282 {URL_SCHEME_HTTP,S_OK,FALSE},
1283 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1284 }
1285 },
1286 /* UINT_MAX+1 */
1287 { "http://4294967296/", 0, S_OK, FALSE,
1288 {
1289 {"http://4294967296/",S_OK,FALSE},
1290 {"4294967296",S_OK,FALSE},
1291 {"http://4294967296/",S_OK,FALSE},
1292 {"",S_FALSE,FALSE},
1293 {"",S_FALSE,FALSE},
1294 {"",S_FALSE,FALSE},
1295 {"4294967296",S_OK,FALSE},
1296 {"",S_FALSE,FALSE},
1297 {"/",S_OK,FALSE},
1298 {"/",S_OK,FALSE},
1299 {"",S_FALSE,FALSE},
1300 {"http://4294967296/",S_OK,FALSE},
1301 {"http",S_OK,FALSE},
1302 {"",S_FALSE,FALSE},
1303 {"",S_FALSE,FALSE}
1304 },
1305 {
1306 {Uri_HOST_DNS,S_OK,FALSE},
1307 {80,S_OK,FALSE},
1308 {URL_SCHEME_HTTP,S_OK,FALSE},
1309 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1310 }
1311 },
1312 /* Window's doesn't normalize IP address for unknown schemes. */
1313 { "1234://4294967295/", 0, S_OK, FALSE,
1314 {
1315 {"1234://4294967295/",S_OK,FALSE},
1316 {"4294967295",S_OK,FALSE},
1317 {"1234://4294967295/",S_OK,FALSE},
1318 {"",S_FALSE,FALSE},
1319 {"",S_FALSE,FALSE},
1320 {"",S_FALSE,FALSE},
1321 {"4294967295",S_OK,FALSE},
1322 {"",S_FALSE,FALSE},
1323 {"/",S_OK,FALSE},
1324 {"/",S_OK,FALSE},
1325 {"",S_FALSE,FALSE},
1326 {"1234://4294967295/",S_OK,FALSE},
1327 {"1234",S_OK,FALSE},
1328 {"",S_FALSE,FALSE},
1329 {"",S_FALSE,FALSE}
1330 },
1331 {
1332 {Uri_HOST_IPV4,S_OK,FALSE},
1333 {0,S_FALSE,FALSE},
1334 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1335 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1336 }
1337 },
1338 /* Window's doesn't normalize IP address for unknown schemes. */
1339 { "1234://127.001/", 0, S_OK, FALSE,
1340 {
1341 {"1234://127.001/",S_OK,FALSE},
1342 {"127.001",S_OK,FALSE},
1343 {"1234://127.001/",S_OK,FALSE},
1344 {"",S_FALSE,FALSE},
1345 {"",S_FALSE,FALSE},
1346 {"",S_FALSE,FALSE},
1347 {"127.001",S_OK,FALSE},
1348 {"",S_FALSE,FALSE},
1349 {"/",S_OK,FALSE},
1350 {"/",S_OK,FALSE},
1351 {"",S_FALSE,FALSE},
1352 {"1234://127.001/",S_OK,FALSE},
1353 {"1234",S_OK,FALSE},
1354 {"",S_FALSE,FALSE},
1355 {"",S_FALSE,FALSE}
1356 },
1357 {
1358 {Uri_HOST_IPV4,S_OK,FALSE},
1359 {0,S_FALSE,FALSE},
1360 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1361 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1362 }
1363 },
1364 { "http://[FEDC:BA98::3210]", 0, S_OK, FALSE,
1365 {
1366 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1367 {"[fedc:ba98::3210]",S_OK,FALSE},
1368 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1369 {"",S_FALSE,FALSE},
1370 {"",S_FALSE,FALSE},
1371 {"",S_FALSE,FALSE},
1372 {"fedc:ba98::3210",S_OK,FALSE},
1373 {"",S_FALSE,FALSE},
1374 {"/",S_OK,FALSE},
1375 {"/",S_OK,FALSE},
1376 {"",S_FALSE,FALSE},
1377 {"http://[FEDC:BA98::3210]",S_OK,FALSE},
1378 {"http",S_OK,FALSE},
1379 {"",S_FALSE,FALSE},
1380 {"",S_FALSE,FALSE},
1381 },
1382 {
1383 {Uri_HOST_IPV6,S_OK,FALSE},
1384 {80,S_OK,FALSE},
1385 {URL_SCHEME_HTTP,S_OK,FALSE},
1386 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1387 }
1388 },
1389 { "http://[::]", 0, S_OK, FALSE,
1390 {
1391 {"http://[::]/",S_OK,FALSE},
1392 {"[::]",S_OK,FALSE},
1393 {"http://[::]/",S_OK,FALSE},
1394 {"",S_FALSE,FALSE},
1395 {"",S_FALSE,FALSE},
1396 {"",S_FALSE,FALSE},
1397 {"::",S_OK,FALSE},
1398 {"",S_FALSE,FALSE},
1399 {"/",S_OK,FALSE},
1400 {"/",S_OK,FALSE},
1401 {"",S_FALSE,FALSE},
1402 {"http://[::]",S_OK,FALSE},
1403 {"http",S_OK,FALSE},
1404 {"",S_FALSE,FALSE},
1405 {"",S_FALSE,FALSE},
1406 },
1407 {
1408 {Uri_HOST_IPV6,S_OK,FALSE},
1409 {80,S_OK,FALSE},
1410 {URL_SCHEME_HTTP,S_OK,FALSE},
1411 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1412 }
1413 },
1414 { "http://[FEDC:BA98::]", 0, S_OK, FALSE,
1415 {
1416 {"http://[fedc:ba98::]/",S_OK,FALSE},
1417 {"[fedc:ba98::]",S_OK,FALSE},
1418 {"http://[fedc:ba98::]/",S_OK,FALSE},
1419 {"",S_FALSE,FALSE},
1420 {"",S_FALSE,FALSE},
1421 {"",S_FALSE,FALSE},
1422 {"fedc:ba98::",S_OK,FALSE},
1423 {"",S_FALSE,FALSE},
1424 {"/",S_OK,FALSE},
1425 {"/",S_OK,FALSE},
1426 {"",S_FALSE,FALSE},
1427 {"http://[FEDC:BA98::]",S_OK,FALSE},
1428 {"http",S_OK,FALSE},
1429 {"",S_FALSE,FALSE},
1430 {"",S_FALSE,FALSE},
1431 },
1432 {
1433 {Uri_HOST_IPV6,S_OK,FALSE},
1434 {80,S_OK,FALSE},
1435 {URL_SCHEME_HTTP,S_OK,FALSE},
1436 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1437 }
1438 },
1439 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1440 { "http://[1::3:4:5:6:7:8]", 0, S_OK, FALSE,
1441 {
1442 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1443 {"[1:0:3:4:5:6:7:8]",S_OK,FALSE},
1444 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1445 {"",S_FALSE,FALSE},
1446 {"",S_FALSE,FALSE},
1447 {"",S_FALSE,FALSE},
1448 {"1:0:3:4:5:6:7:8",S_OK,FALSE},
1449 {"",S_FALSE,FALSE},
1450 {"/",S_OK,FALSE},
1451 {"/",S_OK,FALSE},
1452 {"",S_FALSE,FALSE},
1453 {"http://[1::3:4:5:6:7:8]",S_OK,FALSE},
1454 {"http",S_OK,FALSE},
1455 {"",S_FALSE,FALSE},
1456 {"",S_FALSE,FALSE},
1457 },
1458 {
1459 {Uri_HOST_IPV6,S_OK,FALSE},
1460 {80,S_OK,FALSE},
1461 {URL_SCHEME_HTTP,S_OK,FALSE},
1462 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1463 }
1464 },
1465 { "http://[v2.34]/", 0, S_OK, FALSE,
1466 {
1467 {"http://[v2.34]/",S_OK,FALSE},
1468 {"[v2.34]",S_OK,FALSE},
1469 {"http://[v2.34]/",S_OK,FALSE},
1470 {"",S_FALSE,FALSE},
1471 {"",S_FALSE,FALSE},
1472 {"",S_FALSE,FALSE},
1473 {"[v2.34]",S_OK,FALSE},
1474 {"",S_FALSE,FALSE},
1475 {"/",S_OK,FALSE},
1476 {"/",S_OK,FALSE},
1477 {"",S_FALSE,FALSE},
1478 {"http://[v2.34]/",S_OK,FALSE},
1479 {"http",S_OK,FALSE},
1480 {"",S_FALSE,FALSE},
1481 {"",S_FALSE,FALSE}
1482 },
1483 {
1484 {Uri_HOST_UNKNOWN,S_OK,FALSE},
1485 {80,S_OK,FALSE},
1486 {URL_SCHEME_HTTP,S_OK,FALSE},
1487 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1488 }
1489 },
1490 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1491 { "http://[xyz:12345.com/test", 0, S_OK, FALSE,
1492 {
1493 {"http://[xyz:12345.com/test",S_OK,FALSE},
1494 {"[xyz:12345.com",S_OK,FALSE},
1495 {"http://[xyz:12345.com/test",S_OK,FALSE},
1496 {"[xyz:12345.com",S_OK,FALSE},
1497 {"",S_FALSE,FALSE},
1498 {"",S_FALSE,FALSE},
1499 {"[xyz:12345.com",S_OK,FALSE},
1500 {"",S_FALSE,FALSE},
1501 {"/test",S_OK,FALSE},
1502 {"/test",S_OK,FALSE},
1503 {"",S_FALSE,FALSE},
1504 {"http://[xyz:12345.com/test",S_OK,FALSE},
1505 {"http",S_OK,FALSE},
1506 {"",S_FALSE,FALSE},
1507 {"",S_FALSE,FALSE}
1508 },
1509 {
1510 {Uri_HOST_DNS,S_OK,FALSE},
1511 {80,S_OK,FALSE},
1512 {URL_SCHEME_HTTP,S_OK,FALSE},
1513 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1514 }
1515 },
1516 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1517 * of the host name (respectively).
1518 */
1519 { "ftp://www.[works].com/", 0, S_OK, FALSE,
1520 {
1521 {"ftp://www.[works].com/",S_OK,FALSE},
1522 {"www.[works].com",S_OK,FALSE},
1523 {"ftp://www.[works].com/",S_OK,FALSE},
1524 {"[works].com",S_OK,FALSE},
1525 {"",S_FALSE,FALSE},
1526 {"",S_FALSE,FALSE},
1527 {"www.[works].com",S_OK,FALSE},
1528 {"",S_FALSE,FALSE},
1529 {"/",S_OK,FALSE},
1530 {"/",S_OK,FALSE},
1531 {"",S_FALSE,FALSE},
1532 {"ftp://www.[works].com/",S_OK,FALSE},
1533 {"ftp",S_OK,FALSE},
1534 {"",S_FALSE,FALSE},
1535 {"",S_FALSE,FALSE}
1536 },
1537 {
1538 {Uri_HOST_DNS,S_OK,FALSE},
1539 {21,S_OK,FALSE},
1540 {URL_SCHEME_FTP,S_OK,FALSE},
1541 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1542 }
1543 },
1544 /* Considers ':' a delimiter since it appears after the ']'. */
1545 { "http://www.google.com]:12345/", 0, S_OK, FALSE,
1546 {
1547 {"http://www.google.com]:12345/",S_OK,FALSE},
1548 {"www.google.com]:12345",S_OK,FALSE},
1549 {"http://www.google.com]:12345/",S_OK,FALSE},
1550 {"google.com]",S_OK,FALSE},
1551 {"",S_FALSE,FALSE},
1552 {"",S_FALSE,FALSE},
1553 {"www.google.com]",S_OK,FALSE},
1554 {"",S_FALSE,FALSE},
1555 {"/",S_OK,FALSE},
1556 {"/",S_OK,FALSE},
1557 {"",S_FALSE,FALSE},
1558 {"http://www.google.com]:12345/",S_OK,FALSE},
1559 {"http",S_OK,FALSE},
1560 {"",S_FALSE,FALSE},
1561 {"",S_FALSE,FALSE}
1562 },
1563 {
1564 {Uri_HOST_DNS,S_OK,FALSE},
1565 {12345,S_OK,FALSE},
1566 {URL_SCHEME_HTTP,S_OK,FALSE},
1567 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1568 }
1569 },
1570 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1571 { "zip://w%XXw%GEw.google.com/", 0, S_OK, FALSE,
1572 {
1573 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1574 {"w%XXw%GEw.google.com",S_OK,FALSE},
1575 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1576 {"google.com",S_OK,FALSE},
1577 {"",S_FALSE,FALSE},
1578 {"",S_FALSE,FALSE},
1579 {"w%XXw%GEw.google.com",S_OK,FALSE},
1580 {"",S_FALSE,FALSE},
1581 {"/",S_OK,FALSE},
1582 {"/",S_OK,FALSE},
1583 {"",S_FALSE,FALSE},
1584 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1585 {"zip",S_OK,FALSE},
1586 {"",S_FALSE,FALSE},
1587 {"",S_FALSE,FALSE}
1588 },
1589 {
1590 {Uri_HOST_DNS,S_OK,FALSE},
1591 {0,S_FALSE,FALSE},
1592 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1593 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1594 }
1595 },
1596 /* Unknown scheme types hostname doesn't get lower cased. */
1597 { "zip://GOOGLE.com/", 0, S_OK, FALSE,
1598 {
1599 {"zip://GOOGLE.com/",S_OK,FALSE},
1600 {"GOOGLE.com",S_OK,FALSE},
1601 {"zip://GOOGLE.com/",S_OK,FALSE},
1602 {"GOOGLE.com",S_OK,FALSE},
1603 {"",S_FALSE,FALSE},
1604 {"",S_FALSE,FALSE},
1605 {"GOOGLE.com",S_OK,FALSE},
1606 {"",S_FALSE,FALSE},
1607 {"/",S_OK,FALSE},
1608 {"/",S_OK,FALSE},
1609 {"",S_FALSE,FALSE},
1610 {"zip://GOOGLE.com/",S_OK,FALSE},
1611 {"zip",S_OK,FALSE},
1612 {"",S_FALSE,FALSE},
1613 {"",S_FALSE,FALSE}
1614 },
1615 {
1616 {Uri_HOST_DNS,S_OK,FALSE},
1617 {0,S_FALSE,FALSE},
1618 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1619 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1620 }
1621 },
1622 /* Hostname gets lower-cased for known scheme types. */
1623 { "http://WWW.GOOGLE.com/", 0, S_OK, FALSE,
1624 {
1625 {"http://www.google.com/",S_OK,FALSE},
1626 {"www.google.com",S_OK,FALSE},
1627 {"http://www.google.com/",S_OK,FALSE},
1628 {"google.com",S_OK,FALSE},
1629 {"",S_FALSE,FALSE},
1630 {"",S_FALSE,FALSE},
1631 {"www.google.com",S_OK,FALSE},
1632 {"",S_FALSE,FALSE},
1633 {"/",S_OK,FALSE},
1634 {"/",S_OK,FALSE},
1635 {"",S_FALSE,FALSE},
1636 {"http://WWW.GOOGLE.com/",S_OK,FALSE},
1637 {"http",S_OK,FALSE},
1638 {"",S_FALSE,FALSE},
1639 {"",S_FALSE,FALSE}
1640 },
1641 {
1642 {Uri_HOST_DNS,S_OK,FALSE},
1643 {80,S_OK,FALSE},
1644 {URL_SCHEME_HTTP,S_OK,FALSE},
1645 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1646 }
1647 },
1648 /* Characters that get % encoded in the hostname also have their percent
1649 * encoded forms lower cased.
1650 */
1651 { "http://www.%7Cgoogle|.com/", 0, S_OK, FALSE,
1652 {
1653 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1654 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1655 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1656 {"%7cgoogle%7c.com",S_OK,FALSE},
1657 {"",S_FALSE,FALSE},
1658 {"",S_FALSE,FALSE},
1659 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1660 {"",S_FALSE,FALSE},
1661 {"/",S_OK,FALSE},
1662 {"/",S_OK,FALSE},
1663 {"",S_FALSE,FALSE},
1664 {"http://www.%7Cgoogle|.com/",S_OK,FALSE},
1665 {"http",S_OK,FALSE},
1666 {"",S_FALSE,FALSE},
1667 {"",S_FALSE,FALSE}
1668 },
1669 {
1670 {Uri_HOST_DNS,S_OK,FALSE},
1671 {80,S_OK,FALSE},
1672 {URL_SCHEME_HTTP,S_OK,FALSE},
1673 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1674 }
1675 },
1676 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1677 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK, FALSE,
1678 {
1679 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1680 {"[1:2:3:4:5:6::]",S_OK,FALSE},
1681 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1682 {"",S_FALSE,FALSE},
1683 {"",S_FALSE,FALSE},
1684 {"",S_FALSE,FALSE},
1685 {"1:2:3:4:5:6::",S_OK,FALSE},
1686 {"",S_FALSE,FALSE},
1687 {"/",S_OK,FALSE},
1688 {"/",S_OK,FALSE},
1689 {"",S_FALSE,FALSE},
1690 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK,FALSE},
1691 {"http",S_OK,FALSE},
1692 {"",S_FALSE,FALSE},
1693 {"",S_FALSE,FALSE},
1694 },
1695 {
1696 {Uri_HOST_IPV6,S_OK,FALSE},
1697 {80,S_OK,FALSE},
1698 {URL_SCHEME_HTTP,S_OK,FALSE},
1699 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1700 }
1701 },
1702 /* IPv4 addresses get normalized. */
1703 { "http://[::001.002.003.000]", 0, S_OK, FALSE,
1704 {
1705 {"http://[::1.2.3.0]/",S_OK,FALSE},
1706 {"[::1.2.3.0]",S_OK,FALSE},
1707 {"http://[::1.2.3.0]/",S_OK,FALSE},
1708 {"",S_FALSE,FALSE},
1709 {"",S_FALSE,FALSE},
1710 {"",S_FALSE,FALSE},
1711 {"::1.2.3.0",S_OK,FALSE},
1712 {"",S_FALSE,FALSE},
1713 {"/",S_OK,FALSE},
1714 {"/",S_OK,FALSE},
1715 {"",S_FALSE,FALSE},
1716 {"http://[::001.002.003.000]",S_OK,FALSE},
1717 {"http",S_OK,FALSE},
1718 {"",S_FALSE,FALSE},
1719 {"",S_FALSE,FALSE},
1720 },
1721 {
1722 {Uri_HOST_IPV6,S_OK,FALSE},
1723 {80,S_OK,FALSE},
1724 {URL_SCHEME_HTTP,S_OK,FALSE},
1725 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1726 }
1727 },
1728 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1729 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK, FALSE,
1730 {
1731 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1732 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1733 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1734 {"",S_FALSE,FALSE},
1735 {"",S_FALSE,FALSE},
1736 {"",S_FALSE,FALSE},
1737 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE},
1738 {"",S_FALSE,FALSE},
1739 {"/",S_OK,FALSE},
1740 {"/",S_OK,FALSE},
1741 {"",S_FALSE,FALSE},
1742 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1743 {"zip",S_OK,FALSE},
1744 {"",S_FALSE,FALSE},
1745 {"",S_FALSE,FALSE},
1746 },
1747 {
1748 {Uri_HOST_IPV6,S_OK,FALSE},
1749 {0,S_FALSE,FALSE},
1750 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1751 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1752 }
1753 },
1754 /* IPv4 address is converted into 2 h16 components. */
1755 { "http://[ffff::192.222.111.32]", 0, S_OK, FALSE,
1756 {
1757 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1758 {"[ffff::c0de:6f20]",S_OK,FALSE},
1759 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1760 {"",S_FALSE,FALSE},
1761 {"",S_FALSE,FALSE},
1762 {"",S_FALSE,FALSE},
1763 {"ffff::c0de:6f20",S_OK,FALSE},
1764 {"",S_FALSE,FALSE},
1765 {"/",S_OK,FALSE},
1766 {"/",S_OK,FALSE},
1767 {"",S_FALSE,FALSE},
1768 {"http://[ffff::192.222.111.32]",S_OK,FALSE},
1769 {"http",S_OK,FALSE},
1770 {"",S_FALSE,FALSE},
1771 {"",S_FALSE,FALSE},
1772 },
1773 {
1774 {Uri_HOST_IPV6,S_OK,FALSE},
1775 {80,S_OK,FALSE},
1776 {URL_SCHEME_HTTP,S_OK,FALSE},
1777 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1778 }
1779 },
1780 /* Max value for a port. */
1781 { "http://google.com:65535", 0, S_OK, FALSE,
1782 {
1783 {"http://google.com:65535/",S_OK,FALSE},
1784 {"google.com:65535",S_OK,FALSE},
1785 {"http://google.com:65535/",S_OK,FALSE},
1786 {"google.com",S_OK,FALSE},
1787 {"",S_FALSE,FALSE},
1788 {"",S_FALSE,FALSE},
1789 {"google.com",S_OK,FALSE},
1790 {"",S_FALSE,FALSE},
1791 {"/",S_OK,FALSE},
1792 {"/",S_OK,FALSE},
1793 {"",S_FALSE,FALSE},
1794 {"http://google.com:65535",S_OK,FALSE},
1795 {"http",S_OK,FALSE},
1796 {"",S_FALSE,FALSE},
1797 {"",S_FALSE,FALSE}
1798 },
1799 {
1800 {Uri_HOST_DNS,S_OK,FALSE},
1801 {65535,S_OK,FALSE},
1802 {URL_SCHEME_HTTP,S_OK,FALSE},
1803 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1804 }
1805 },
1806 { "zip://google.com:65536", 0, S_OK, FALSE,
1807 {
1808 {"zip://google.com:65536/",S_OK,FALSE},
1809 {"google.com:65536",S_OK,FALSE},
1810 {"zip://google.com:65536/",S_OK,FALSE},
1811 {"google.com:65536",S_OK,FALSE},
1812 {"",S_FALSE,FALSE},
1813 {"",S_FALSE,FALSE},
1814 {"google.com:65536",S_OK,FALSE},
1815 {"",S_FALSE,FALSE},
1816 {"/",S_OK,FALSE},
1817 {"/",S_OK,FALSE},
1818 {"",S_FALSE,FALSE},
1819 {"zip://google.com:65536",S_OK,FALSE},
1820 {"zip",S_OK,FALSE},
1821 {"",S_FALSE,FALSE},
1822 {"",S_FALSE,FALSE}
1823 },
1824 {
1825 {Uri_HOST_DNS,S_OK,FALSE},
1826 {0,S_FALSE,FALSE},
1827 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1828 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1829 }
1830 },
1831 { "zip://google.com:65536:25", 0, S_OK, FALSE,
1832 {
1833 {"zip://google.com:65536:25/",S_OK,FALSE},
1834 {"google.com:65536:25",S_OK,FALSE},
1835 {"zip://google.com:65536:25/",S_OK,FALSE},
1836 {"google.com:65536:25",S_OK,FALSE},
1837 {"",S_FALSE,FALSE},
1838 {"",S_FALSE,FALSE},
1839 {"google.com:65536:25",S_OK,FALSE},
1840 {"",S_FALSE,FALSE},
1841 {"/",S_OK,FALSE},
1842 {"/",S_OK,FALSE},
1843 {"",S_FALSE,FALSE},
1844 {"zip://google.com:65536:25",S_OK,FALSE},
1845 {"zip",S_OK,FALSE},
1846 {"",S_FALSE,FALSE},
1847 {"",S_FALSE,FALSE}
1848 },
1849 {
1850 {Uri_HOST_DNS,S_OK,FALSE},
1851 {0,S_FALSE,FALSE},
1852 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1853 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1854 }
1855 },
1856 { "zip://[::ffff]:abcd", 0, S_OK, FALSE,
1857 {
1858 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1859 {"[::ffff]:abcd",S_OK,FALSE},
1860 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1861 {"",S_FALSE,FALSE},
1862 {"",S_FALSE,FALSE},
1863 {"",S_FALSE,FALSE},
1864 {"[::ffff]:abcd",S_OK,FALSE},
1865 {"",S_FALSE,FALSE},
1866 {"/",S_OK,FALSE},
1867 {"/",S_OK,FALSE},
1868 {"",S_FALSE,FALSE},
1869 {"zip://[::ffff]:abcd",S_OK,FALSE},
1870 {"zip",S_OK,FALSE},
1871 {"",S_FALSE,FALSE},
1872 {"",S_FALSE,FALSE}
1873 },
1874 {
1875 {Uri_HOST_DNS,S_OK,FALSE},
1876 {0,S_FALSE,FALSE},
1877 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1878 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1879 }
1880 },
1881 { "zip://127.0.0.1:abcd", 0, S_OK, FALSE,
1882 {
1883 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1884 {"127.0.0.1:abcd",S_OK,FALSE},
1885 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1886 {"0.1:abcd",S_OK,FALSE},
1887 {"",S_FALSE,FALSE},
1888 {"",S_FALSE,FALSE},
1889 {"127.0.0.1:abcd",S_OK,FALSE},
1890 {"",S_FALSE,FALSE},
1891 {"/",S_OK,FALSE},
1892 {"/",S_OK,FALSE},
1893 {"",S_FALSE,FALSE},
1894 {"zip://127.0.0.1:abcd",S_OK,FALSE},
1895 {"zip",S_OK,FALSE},
1896 {"",S_FALSE,FALSE},
1897 {"",S_FALSE,FALSE}
1898 },
1899 {
1900 {Uri_HOST_DNS,S_OK,FALSE},
1901 {0,S_FALSE,FALSE},
1902 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1903 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1904 }
1905 },
1906 /* Port is just copied over. */
1907 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1908 {
1909 {"http://google.com:00035",S_OK,FALSE},
1910 {"google.com:00035",S_OK,FALSE},
1911 {"http://google.com:00035",S_OK,FALSE,"http://google.com:35"},
1912 {"google.com",S_OK,FALSE},
1913 {"",S_FALSE,FALSE},
1914 {"",S_FALSE,FALSE},
1915 {"google.com",S_OK,FALSE},
1916 {"",S_FALSE,FALSE},
1917 {"",S_FALSE,FALSE},
1918 {"",S_FALSE,FALSE},
1919 {"",S_FALSE,FALSE},
1920 {"http://google.com:00035",S_OK,FALSE},
1921 {"http",S_OK,FALSE},
1922 {"",S_FALSE,FALSE},
1923 {"",S_FALSE,FALSE}
1924 },
1925 {
1926 {Uri_HOST_DNS,S_OK,FALSE},
1927 {35,S_OK,FALSE},
1928 {URL_SCHEME_HTTP,S_OK,FALSE},
1929 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1930 }
1931 },
1932 /* Default port is copied over. */
1933 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1934 {
1935 {"http://google.com:80",S_OK,FALSE},
1936 {"google.com:80",S_OK,FALSE},
1937 {"http://google.com:80",S_OK,FALSE},
1938 {"google.com",S_OK,FALSE},
1939 {"",S_FALSE,FALSE},
1940 {"",S_FALSE,FALSE},
1941 {"google.com",S_OK,FALSE},
1942 {"",S_FALSE,FALSE},
1943 {"",S_FALSE,FALSE},
1944 {"",S_FALSE,FALSE},
1945 {"",S_FALSE,FALSE},
1946 {"http://google.com:80",S_OK,FALSE},
1947 {"http",S_OK,FALSE},
1948 {"",S_FALSE,FALSE},
1949 {"",S_FALSE,FALSE}
1950 },
1951 {
1952 {Uri_HOST_DNS,S_OK,FALSE},
1953 {80,S_OK,FALSE},
1954 {URL_SCHEME_HTTP,S_OK,FALSE},
1955 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1956 }
1957 },
1958 { "http://google.com.uk", 0, S_OK, FALSE,
1959 {
1960 {"http://google.com.uk/",S_OK,FALSE},
1961 {"google.com.uk",S_OK,FALSE},
1962 {"http://google.com.uk/",S_OK,FALSE},
1963 {"google.com.uk",S_OK,FALSE,NULL,"com.uk",S_OK}, /* cf. google.co.uk below */
1964 {"",S_FALSE,FALSE},
1965 {"",S_FALSE,FALSE},
1966 {"google.com.uk",S_OK,FALSE},
1967 {"",S_FALSE,FALSE},
1968 {"/",S_OK,FALSE},
1969 {"/",S_OK,FALSE},
1970 {"",S_FALSE,FALSE},
1971 {"http://google.com.uk",S_OK,FALSE},
1972 {"http",S_OK,FALSE},
1973 {"",S_FALSE,FALSE},
1974 {"",S_FALSE,FALSE}
1975 },
1976 {
1977 {Uri_HOST_DNS,S_OK,FALSE},
1978 {80,S_OK,FALSE},
1979 {URL_SCHEME_HTTP,S_OK,FALSE},
1980 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1981 }
1982 },
1983 { "http://google.co.uk", 0, S_OK, FALSE,
1984 {
1985 {"http://google.co.uk/",S_OK,FALSE},
1986 {"google.co.uk",S_OK,FALSE},
1987 {"http://google.co.uk/",S_OK,FALSE},
1988 {"google.co.uk",S_OK,FALSE},
1989 {"",S_FALSE,FALSE},
1990 {"",S_FALSE,FALSE},
1991 {"google.co.uk",S_OK,FALSE},
1992 {"",S_FALSE,FALSE},
1993 {"/",S_OK,FALSE},
1994 {"/",S_OK,FALSE},
1995 {"",S_FALSE,FALSE},
1996 {"http://google.co.uk",S_OK,FALSE},
1997 {"http",S_OK,FALSE},
1998 {"",S_FALSE,FALSE},
1999 {"",S_FALSE,FALSE}
2000 },
2001 {
2002 {Uri_HOST_DNS,S_OK,FALSE},
2003 {80,S_OK,FALSE},
2004 {URL_SCHEME_HTTP,S_OK,FALSE},
2005 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2006 }
2007 },
2008 { "http://google.com.com", 0, S_OK, FALSE,
2009 {
2010 {"http://google.com.com/",S_OK,FALSE},
2011 {"google.com.com",S_OK,FALSE},
2012 {"http://google.com.com/",S_OK,FALSE},
2013 {"com.com",S_OK,FALSE},
2014 {"",S_FALSE,FALSE},
2015 {"",S_FALSE,FALSE},
2016 {"google.com.com",S_OK,FALSE},
2017 {"",S_FALSE,FALSE},
2018 {"/",S_OK,FALSE},
2019 {"/",S_OK,FALSE},
2020 {"",S_FALSE,FALSE},
2021 {"http://google.com.com",S_OK,FALSE},
2022 {"http",S_OK,FALSE},
2023 {"",S_FALSE,FALSE},
2024 {"",S_FALSE,FALSE}
2025 },
2026 {
2027 {Uri_HOST_DNS,S_OK,FALSE},
2028 {80,S_OK,FALSE},
2029 {URL_SCHEME_HTTP,S_OK,FALSE},
2030 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2031 }
2032 },
2033 { "http://google.uk.1", 0, S_OK, FALSE,
2034 {
2035 {"http://google.uk.1/",S_OK,FALSE},
2036 {"google.uk.1",S_OK,FALSE},
2037 {"http://google.uk.1/",S_OK,FALSE},
2038 {"google.uk.1",S_OK,FALSE,NULL,"uk.1",S_OK},
2039 {"",S_FALSE,FALSE},
2040 {"",S_FALSE,FALSE},
2041 {"google.uk.1",S_OK,FALSE},
2042 {"",S_FALSE,FALSE},
2043 {"/",S_OK,FALSE},
2044 {"/",S_OK,FALSE},
2045 {"",S_FALSE,FALSE},
2046 {"http://google.uk.1",S_OK,FALSE},
2047 {"http",S_OK,FALSE},
2048 {"",S_FALSE,FALSE},
2049 {"",S_FALSE,FALSE}
2050 },
2051 {
2052 {Uri_HOST_DNS,S_OK,FALSE},
2053 {80,S_OK,FALSE},
2054 {URL_SCHEME_HTTP,S_OK,FALSE},
2055 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2056 }
2057 },
2058 /* Since foo isn't a recognized 3 character TLD it's considered the domain name. */
2059 { "http://google.foo.uk", 0, S_OK, FALSE,
2060 {
2061 {"http://google.foo.uk/",S_OK,FALSE},
2062 {"google.foo.uk",S_OK,FALSE},
2063 {"http://google.foo.uk/",S_OK,FALSE},
2064 {"foo.uk",S_OK,FALSE},
2065 {"",S_FALSE,FALSE},
2066 {"",S_FALSE,FALSE},
2067 {"google.foo.uk",S_OK,FALSE},
2068 {"",S_FALSE,FALSE},
2069 {"/",S_OK,FALSE},
2070 {"/",S_OK,FALSE},
2071 {"",S_FALSE,FALSE},
2072 {"http://google.foo.uk",S_OK,FALSE},
2073 {"http",S_OK,FALSE},
2074 {"",S_FALSE,FALSE},
2075 {"",S_FALSE,FALSE}
2076 },
2077 {
2078 {Uri_HOST_DNS,S_OK,FALSE},
2079 {80,S_OK,FALSE},
2080 {URL_SCHEME_HTTP,S_OK,FALSE},
2081 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2082 }
2083 },
2084 { "http://.com", 0, S_OK, FALSE,
2085 {
2086 {"http://.com/",S_OK,FALSE},
2087 {".com",S_OK,FALSE},
2088 {"http://.com/",S_OK,FALSE},
2089 {".com",S_OK,FALSE},
2090 {"",S_FALSE,FALSE},
2091 {"",S_FALSE,FALSE},
2092 {".com",S_OK,FALSE},
2093 {"",S_FALSE,FALSE},
2094 {"/",S_OK,FALSE},
2095 {"/",S_OK,FALSE},
2096 {"",S_FALSE,FALSE},
2097 {"http://.com",S_OK,FALSE},
2098 {"http",S_OK,FALSE},
2099 {"",S_FALSE,FALSE},
2100 {"",S_FALSE,FALSE}
2101 },
2102 {
2103 {Uri_HOST_DNS,S_OK,FALSE},
2104 {80,S_OK,FALSE},
2105 {URL_SCHEME_HTTP,S_OK,FALSE},
2106 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2107 }
2108 },
2109 { "http://.uk", 0, S_OK, FALSE,
2110 {
2111 {"http://.uk/",S_OK,FALSE},
2112 {".uk",S_OK,FALSE},
2113 {"http://.uk/",S_OK,FALSE},
2114 {"",S_FALSE,FALSE,NULL,".uk",S_OK},
2115 {"",S_FALSE,FALSE},
2116 {"",S_FALSE,FALSE},
2117 {".uk",S_OK,FALSE},
2118 {"",S_FALSE,FALSE},
2119 {"/",S_OK,FALSE},
2120 {"/",S_OK,FALSE},
2121 {"",S_FALSE,FALSE},
2122 {"http://.uk",S_OK,FALSE},
2123 {"http",S_OK,FALSE},
2124 {"",S_FALSE,FALSE},
2125 {"",S_FALSE,FALSE}
2126 },
2127 {
2128 {Uri_HOST_DNS,S_OK,FALSE},
2129 {80,S_OK,FALSE},
2130 {URL_SCHEME_HTTP,S_OK,FALSE},
2131 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2132 }
2133 },
2134 { "http://www.co.google.com.[]", 0, S_OK, FALSE,
2135 {
2136 {"http://www.co.google.com.[]/",S_OK,FALSE},
2137 {"www.co.google.com.[]",S_OK,FALSE},
2138 {"http://www.co.google.com.[]/",S_OK,FALSE},
2139 {"google.com.[]",S_OK,FALSE,NULL,"com.[]",S_OK},
2140 {"",S_FALSE,FALSE},
2141 {"",S_FALSE,FALSE},
2142 {"www.co.google.com.[]",S_OK,FALSE},
2143 {"",S_FALSE,FALSE},
2144 {"/",S_OK,FALSE},
2145 {"/",S_OK,FALSE},
2146 {"",S_FALSE,FALSE},
2147 {"http://www.co.google.com.[]",S_OK,FALSE},
2148 {"http",S_OK,FALSE},
2149 {"",S_FALSE,FALSE},
2150 {"",S_FALSE,FALSE}
2151 },
2152 {
2153 {Uri_HOST_DNS,S_OK,FALSE},
2154 {80,S_OK,FALSE},
2155 {URL_SCHEME_HTTP,S_OK,FALSE},
2156 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2157 }
2158 },
2159 { "http://co.uk", 0, S_OK, FALSE,
2160 {
2161 {"http://co.uk/",S_OK,FALSE},
2162 {"co.uk",S_OK,FALSE},
2163 {"http://co.uk/",S_OK,FALSE},
2164 {"",S_FALSE,FALSE},
2165 {"",S_FALSE,FALSE},
2166 {"",S_FALSE,FALSE},
2167 {"co.uk",S_OK,FALSE},
2168 {"",S_FALSE,FALSE},
2169 {"/",S_OK,FALSE},
2170 {"/",S_OK,FALSE},
2171 {"",S_FALSE,FALSE},
2172 {"http://co.uk",S_OK,FALSE},
2173 {"http",S_OK,FALSE},
2174 {"",S_FALSE,FALSE},
2175 {"",S_FALSE,FALSE}
2176 },
2177 {
2178 {Uri_HOST_DNS,S_OK,FALSE},
2179 {80,S_OK,FALSE},
2180 {URL_SCHEME_HTTP,S_OK,FALSE},
2181 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2182 }
2183 },
2184 { "http://www.co.google.us.test", 0, S_OK, FALSE,
2185 {
2186 {"http://www.co.google.us.test/",S_OK,FALSE},
2187 {"www.co.google.us.test",S_OK,FALSE},
2188 {"http://www.co.google.us.test/",S_OK,FALSE},
2189 {"us.test",S_OK,FALSE},
2190 {"",S_FALSE,FALSE},
2191 {"",S_FALSE,FALSE},
2192 {"www.co.google.us.test",S_OK,FALSE},
2193 {"",S_FALSE,FALSE},
2194 {"/",S_OK,FALSE},
2195 {"/",S_OK,FALSE},
2196 {"",S_FALSE,FALSE},
2197 {"http://www.co.google.us.test",S_OK,FALSE},
2198 {"http",S_OK,FALSE},
2199 {"",S_FALSE,FALSE},
2200 {"",S_FALSE,FALSE}
2201 },
2202 {
2203 {Uri_HOST_DNS,S_OK,FALSE},
2204 {80,S_OK,FALSE},
2205 {URL_SCHEME_HTTP,S_OK,FALSE},
2206 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2207 }
2208 },
2209 { "http://gov.uk", 0, S_OK, FALSE,
2210 {
2211 {"http://gov.uk/",S_OK,FALSE},
2212 {"gov.uk",S_OK,FALSE},
2213 {"http://gov.uk/",S_OK,FALSE},
2214 {"",S_FALSE,FALSE},
2215 {"",S_FALSE,FALSE},
2216 {"",S_FALSE,FALSE},
2217 {"gov.uk",S_OK,FALSE},
2218 {"",S_FALSE,FALSE},
2219 {"/",S_OK,FALSE},
2220 {"/",S_OK,FALSE},
2221 {"",S_FALSE,FALSE},
2222 {"http://gov.uk",S_OK,FALSE},
2223 {"http",S_OK,FALSE},
2224 {"",S_FALSE,FALSE},
2225 {"",S_FALSE,FALSE}
2226 },
2227 {
2228 {Uri_HOST_DNS,S_OK,FALSE},
2229 {80,S_OK,FALSE},
2230 {URL_SCHEME_HTTP,S_OK,FALSE},
2231 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2232 }
2233 },
2234 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2235 {
2236 {"zip://www.google.com\\test",S_OK,FALSE},
2237 {"www.google.com\\test",S_OK,FALSE},
2238 {"zip://www.google.com\\test",S_OK,FALSE},
2239 {"google.com\\test",S_OK,FALSE},
2240 {"",S_FALSE,FALSE},
2241 {"",S_FALSE,FALSE},
2242 {"www.google.com\\test",S_OK,FALSE},
2243 {"",S_FALSE,FALSE},
2244 {"",S_FALSE,FALSE},
2245 {"",S_FALSE,FALSE},
2246 {"",S_FALSE,FALSE},
2247 {"zip://www.google.com\\test",S_OK,FALSE},
2248 {"zip",S_OK,FALSE},
2249 {"",S_FALSE,FALSE},
2250 {"",S_FALSE,FALSE}
2251 },
2252 {
2253 {Uri_HOST_DNS,S_OK,FALSE},
2254 {0,S_FALSE,FALSE},
2255 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2256 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2257 }
2258 },
2259 { "urn:excepts:bad:%XY:encoded", 0, S_OK, FALSE,
2260 {
2261 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2262 {"",S_FALSE,FALSE},
2263 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2264 {"",S_FALSE,FALSE},
2265 {"",S_FALSE,FALSE},
2266 {"",S_FALSE,FALSE},
2267 {"",S_FALSE,FALSE},
2268 {"",S_FALSE,FALSE},
2269 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2270 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2271 {"",S_FALSE,FALSE},
2272 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2273 {"urn",S_OK,FALSE},
2274 {"",S_FALSE,FALSE},
2275 {"",S_FALSE,FALSE}
2276 },
2277 {
2278 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2279 {0,S_FALSE,FALSE},
2280 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2281 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2282 }
2283 },
2284 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2285 * are decoded and all '%' are encoded.
2286 */
2287 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK, FALSE,
2288 {
2289 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2290 {"",S_FALSE,FALSE},
2291 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2292 {"",S_FALSE,FALSE},
2293 {".mp3",S_OK,FALSE},
2294 {"",S_FALSE,FALSE},
2295 {"",S_FALSE,FALSE},
2296 {"",S_FALSE,FALSE},
2297 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2298 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2299 {"",S_FALSE,FALSE},
2300 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK,FALSE},
2301 {"file",S_OK,FALSE},
2302 {"",S_FALSE,FALSE},
2303 {"",S_FALSE,FALSE}
2304 },
2305 {
2306 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2307 {0,S_FALSE,FALSE},
2308 {URL_SCHEME_FILE,S_OK,FALSE},
2309 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2310 }
2311 },
2312 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2313 * is decoded and only %'s in front of invalid hex digits are encoded.
2314 */
2315 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK, FALSE,
2316 {
2317 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2318 {"",S_FALSE,FALSE},
2319 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2320 {"",S_FALSE,FALSE},
2321 {".mp3",S_OK,FALSE},
2322 {"",S_FALSE,FALSE},
2323 {"",S_FALSE,FALSE},
2324 {"",S_FALSE,FALSE},
2325 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2326 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2327 {"",S_FALSE,FALSE},
2328 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK,FALSE},
2329 {"file",S_OK,FALSE},
2330 {"",S_FALSE,FALSE},
2331 {"",S_FALSE,FALSE}
2332 },
2333 {
2334 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2335 {0,S_FALSE,FALSE},
2336 {URL_SCHEME_FILE,S_OK,FALSE},
2337 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2338 }
2339 },
2340 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2341 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK, FALSE,
2342 {
2343 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2344 {"[::1.2.3.0]",S_OK,FALSE},
2345 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2346 {"",S_FALSE,FALSE},
2347 {"",S_FALSE,FALSE},
2348 {"",S_FALSE,FALSE},
2349 {"::1.2.3.0",S_OK,FALSE},
2350 {"",S_FALSE,FALSE},
2351 {"/%3F%23.T/test",S_OK,FALSE},
2352 {"/%3F%23.T/test",S_OK,FALSE},
2353 {"",S_FALSE,FALSE},
2354 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK,FALSE},
2355 {"http",S_OK,FALSE},
2356 {"",S_FALSE,FALSE},
2357 {"",S_FALSE,FALSE},
2358 },
2359 {
2360 {Uri_HOST_IPV6,S_OK,FALSE},
2361 {80,S_OK,FALSE},
2362 {URL_SCHEME_HTTP,S_OK,FALSE},
2363 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2364 }
2365 },
2366 /* Forbidden characters are always encoded for file URIs. */
2367 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2368 {
2369 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2370 {"",S_FALSE,FALSE},
2371 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2372 {"",S_FALSE,FALSE},
2373 {".mp3",S_OK,FALSE},
2374 {"",S_FALSE,FALSE},
2375 {"",S_FALSE,FALSE},
2376 {"",S_FALSE,FALSE},
2377 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2378 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2379 {"",S_FALSE,FALSE},
2380 {"file:///C:/\"test\"/test.mp3",S_OK,FALSE},
2381 {"file",S_OK,FALSE},
2382 {"",S_FALSE,FALSE},
2383 {"",S_FALSE,FALSE}
2384 },
2385 {
2386 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2387 {0,S_FALSE,FALSE},
2388 {URL_SCHEME_FILE,S_OK,FALSE},
2389 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2390 }
2391 },
2392 /* Forbidden characters are never encoded for unknown scheme types. */
2393 { "1234://4294967295/<|>\" test<|>", 0, S_OK, FALSE,
2394 {
2395 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2396 {"4294967295",S_OK,FALSE},
2397 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2398 {"",S_FALSE,FALSE},
2399 {"",S_FALSE,FALSE},
2400 {"",S_FALSE,FALSE},
2401 {"4294967295",S_OK,FALSE},
2402 {"",S_FALSE,FALSE},
2403 {"/<|>\" test<|>",S_OK,FALSE},
2404 {"/<|>\" test<|>",S_OK,FALSE},
2405 {"",S_FALSE,FALSE},
2406 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2407 {"1234",S_OK,FALSE},
2408 {"",S_FALSE,FALSE},
2409 {"",S_FALSE,FALSE}
2410 },
2411 {
2412 {Uri_HOST_IPV4,S_OK,FALSE},
2413 {0,S_FALSE,FALSE},
2414 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2415 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2416 }
2417 },
2418 /* Make sure forbidden characters are percent encoded. */
2419 { "http://gov.uk/<|> test<|>", 0, S_OK, FALSE,
2420 {
2421 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2422 {"gov.uk",S_OK,FALSE},
2423 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2424 {"",S_FALSE,FALSE},
2425 {"",S_FALSE,FALSE},
2426 {"",S_FALSE,FALSE},
2427 {"gov.uk",S_OK,FALSE},
2428 {"",S_FALSE,FALSE},
2429 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2430 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2431 {"",S_FALSE,FALSE},
2432 {"http://gov.uk/<|> test<|>",S_OK,FALSE},
2433 {"http",S_OK,FALSE},
2434 {"",S_FALSE,FALSE},
2435 {"",S_FALSE,FALSE}
2436 },
2437 {
2438 {Uri_HOST_DNS,S_OK,FALSE},
2439 {80,S_OK,FALSE},
2440 {URL_SCHEME_HTTP,S_OK,FALSE},
2441 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2442 }
2443 },
2444 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK, FALSE,
2445 {
2446 {"http://gov.uk/",S_OK,FALSE},
2447 {"gov.uk",S_OK,FALSE},
2448 {"http://gov.uk/",S_OK,FALSE},
2449 {"",S_FALSE,FALSE},
2450 {"",S_FALSE,FALSE},
2451 {"",S_FALSE,FALSE},
2452 {"gov.uk",S_OK,FALSE},
2453 {"",S_FALSE,FALSE},
2454 {"/",S_OK,FALSE},
2455 {"/",S_OK,FALSE},
2456 {"",S_FALSE,FALSE},
2457 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK,FALSE},
2458 {"http",S_OK,FALSE},
2459 {"",S_FALSE,FALSE},
2460 {"",S_FALSE,FALSE}
2461 },
2462 {
2463 {Uri_HOST_DNS,S_OK,FALSE},
2464 {80,S_OK,FALSE},
2465 {URL_SCHEME_HTTP,S_OK,FALSE},
2466 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2467 }
2468 },
2469 { "http://gov.uk/test/test2/../../..", 0, S_OK, FALSE,
2470 {
2471 {"http://gov.uk/",S_OK,FALSE},
2472 {"gov.uk",S_OK,FALSE},
2473 {"http://gov.uk/",S_OK,FALSE},
2474 {"",S_FALSE,FALSE},
2475 {"",S_FALSE,FALSE},
2476 {"",S_FALSE,FALSE},
2477 {"gov.uk",S_OK,FALSE},
2478 {"",S_FALSE,FALSE},
2479 {"/",S_OK,FALSE},
2480 {"/",S_OK,FALSE},
2481 {"",S_FALSE,FALSE},
2482 {"http://gov.uk/test/test2/../../..",S_OK,FALSE},
2483 {"http",S_OK,FALSE},
2484 {"",S_FALSE,FALSE},
2485 {"",S_FALSE,FALSE}
2486 },
2487 {
2488 {Uri_HOST_DNS,S_OK,FALSE},
2489 {80,S_OK,FALSE},
2490 {URL_SCHEME_HTTP,S_OK,FALSE},
2491 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2492 }
2493 },
2494 { "http://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2495 {
2496 {"http://gov.uk/",S_OK,FALSE},
2497 {"gov.uk",S_OK,FALSE},
2498 {"http://gov.uk/",S_OK,FALSE},
2499 {"",S_FALSE,FALSE},
2500 {"",S_FALSE,FALSE},
2501 {"",S_FALSE,FALSE},
2502 {"gov.uk",S_OK,FALSE},
2503 {"",S_FALSE,FALSE},
2504 {"/",S_OK,FALSE},
2505 {"/",S_OK,FALSE},
2506 {"",S_FALSE,FALSE},
2507 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2508 {"http",S_OK,FALSE},
2509 {"",S_FALSE,FALSE},
2510 {"",S_FALSE,FALSE}
2511 },
2512 {
2513 {Uri_HOST_DNS,S_OK,FALSE},
2514 {80,S_OK,FALSE},
2515 {URL_SCHEME_HTTP,S_OK,FALSE},
2516 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2517 }
2518 },
2519 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK, FALSE,
2520 {
2521 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2522 {"",S_FALSE,FALSE},
2523 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2524 {"",S_FALSE,FALSE},
2525 {".mp3",S_OK,FALSE},
2526 {"",S_FALSE,FALSE},
2527 {"",S_FALSE,FALSE},
2528 {"",S_FALSE,FALSE},
2529 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2530 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2531 {"",S_FALSE,FALSE},
2532 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK,FALSE},
2533 {"file",S_OK,FALSE},
2534 {"",S_FALSE,FALSE},
2535 {"",S_FALSE,FALSE}
2536 },
2537 {
2538 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2539 {0,S_FALSE,FALSE},
2540 {URL_SCHEME_FILE,S_OK,FALSE},
2541 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2542 }
2543 },
2544 /* Dot removal happens for unknown scheme types. */
2545 { "zip://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2546 {
2547 {"zip://gov.uk/",S_OK,FALSE},
2548 {"gov.uk",S_OK,FALSE},
2549 {"zip://gov.uk/",S_OK,FALSE},
2550 {"",S_FALSE,FALSE},
2551 {"",S_FALSE,FALSE},
2552 {"",S_FALSE,FALSE},
2553 {"gov.uk",S_OK,FALSE},
2554 {"",S_FALSE,FALSE},
2555 {"/",S_OK,FALSE},
2556 {"/",S_OK,FALSE},
2557 {"",S_FALSE,FALSE},
2558 {"zip://gov.uk/test/test2/../../.",S_OK,FALSE},
2559 {"zip",S_OK,FALSE},
2560 {"",S_FALSE,FALSE},
2561 {"",S_FALSE,FALSE}
2562 },
2563 {
2564 {Uri_HOST_DNS,S_OK,FALSE},
2565 {0,S_FALSE,FALSE},
2566 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2567 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2568 }
2569 },
2570 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2571 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2572 {
2573 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2574 {"gov.uk",S_OK,FALSE},
2575 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2576 {"",S_FALSE,FALSE},
2577 {".",S_OK,FALSE},
2578 {"",S_FALSE,FALSE},
2579 {"gov.uk",S_OK,FALSE},
2580 {"",S_FALSE,FALSE},
2581 {"/test/test2/../../.",S_OK,FALSE},
2582 {"/test/test2/../../.",S_OK,FALSE},
2583 {"",S_FALSE,FALSE},
2584 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2585 {"http",S_OK,FALSE},
2586 {"",S_FALSE,FALSE},
2587 {"",S_FALSE,FALSE}
2588 },
2589 {
2590 {Uri_HOST_DNS,S_OK,FALSE},
2591 {80,S_OK,FALSE},
2592 {URL_SCHEME_HTTP,S_OK,FALSE},
2593 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2594 }
2595 },
2596 /* Dot removal doesn't happen for wildcard scheme types. */
2597 { "*:gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2598 {
2599 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2600 {"gov.uk",S_OK,FALSE},
2601 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2602 {"",S_FALSE,FALSE},
2603 {".",S_OK,FALSE},
2604 {"",S_FALSE,FALSE},
2605 {"gov.uk",S_OK,FALSE},
2606 {"",S_FALSE,FALSE},
2607 {"/test/test2/../../.",S_OK,FALSE},
2608 {"/test/test2/../../.",S_OK,FALSE},
2609 {"",S_FALSE,FALSE},
2610 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2611 {"*",S_OK,FALSE},
2612 {"",S_FALSE,FALSE},
2613 {"",S_FALSE,FALSE}
2614 },
2615 {
2616 {Uri_HOST_DNS,S_OK,FALSE},
2617 {0,S_FALSE,FALSE},
2618 {URL_SCHEME_WILDCARD,S_OK,FALSE},
2619 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2620 }
2621 },
2622 /* Forbidden characters are encoded for opaque known scheme types. */
2623 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK, FALSE,
2624 {
2625 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2626 {"",S_FALSE,FALSE},
2627 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2628 {"",S_FALSE,FALSE},
2629 {".com%22",S_OK,FALSE},
2630 {"",S_FALSE,FALSE},
2631 {"",S_FALSE,FALSE},
2632 {"",S_FALSE,FALSE},
2633 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2634 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2635 {"",S_FALSE,FALSE},
2636 {"mailto:\"acco<|>unt@example.com\"",S_OK,FALSE},
2637 {"mailto",S_OK,FALSE},
2638 {"",S_FALSE,FALSE},
2639 {"",S_FALSE,FALSE}
2640 },
2641 {
2642 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2643 {0,S_FALSE,FALSE},
2644 {URL_SCHEME_MAILTO,S_OK,FALSE},
2645 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2646 }
2647 },
2648 { "news:test.tes<|>t.com", 0, S_OK, FALSE,
2649 {
2650 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2651 {"",S_FALSE,FALSE},
2652 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2653 {"",S_FALSE,FALSE},
2654 {".com",S_OK,FALSE},
2655 {"",S_FALSE,FALSE},
2656 {"",S_FALSE,FALSE},
2657 {"",S_FALSE,FALSE},
2658 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2659 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2660 {"",S_FALSE,FALSE},
2661 {"news:test.tes<|>t.com",S_OK,FALSE},
2662 {"news",S_OK,FALSE},
2663 {"",S_FALSE,FALSE},
2664 {"",S_FALSE,FALSE}
2665 },
2666 {
2667 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2668 {0,S_FALSE,FALSE},
2669 {URL_SCHEME_NEWS,S_OK,FALSE},
2670 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2671 }
2672 },
2673 /* Don't encode forbidden characters. */
2674 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2675 {
2676 {"news:test.tes<|>t.com",S_OK,FALSE},
2677 {"",S_FALSE,FALSE},
2678 {"news:test.tes<|>t.com",S_OK,FALSE},
2679 {"",S_FALSE,FALSE},
2680 {".com",S_OK,FALSE},
2681 {"",S_FALSE,FALSE},
2682 {"",S_FALSE,FALSE},
2683 {"",S_FALSE,FALSE},
2684 {"test.tes<|>t.com",S_OK,FALSE},
2685 {"test.tes<|>t.com",S_OK,FALSE},
2686 {"",S_FALSE,FALSE},
2687 {"news:test.tes<|>t.com",S_OK,FALSE},
2688 {"news",S_OK,FALSE},
2689 {"",S_FALSE,FALSE},
2690 {"",S_FALSE,FALSE}
2691 },
2692 {
2693 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2694 {0,S_FALSE,FALSE},
2695 {URL_SCHEME_NEWS,S_OK,FALSE},
2696 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2697 }
2698 },
2699 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2700 { "urn:test.tes<|>t.com", 0, S_OK, FALSE,
2701 {
2702 {"urn:test.tes<|>t.com",S_OK,FALSE},
2703 {"",S_FALSE,FALSE},
2704 {"urn:test.tes<|>t.com",S_OK,FALSE},
2705 {"",S_FALSE,FALSE},
2706 {".com",S_OK,FALSE},
2707 {"",S_FALSE,FALSE},
2708 {"",S_FALSE,FALSE},
2709 {"",S_FALSE,FALSE},
2710 {"test.tes<|>t.com",S_OK,FALSE},
2711 {"test.tes<|>t.com",S_OK,FALSE},
2712 {"",S_FALSE,FALSE},
2713 {"urn:test.tes<|>t.com",S_OK,FALSE},
2714 {"urn",S_OK,FALSE},
2715 {"",S_FALSE,FALSE},
2716 {"",S_FALSE,FALSE}
2717 },
2718 {
2719 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2720 {0,S_FALSE,FALSE},
2721 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2722 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2723