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