4 * Copyright 2010 Thomas Mullaly
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.
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.
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
22 * IUri testing framework goals:
25 * - invalid args (IUri, uri string)
26 * - Test parsing for components when no canonicalization occurs
27 * - Test parsing for components when canonicalization occurs.
31 #include <wine/test.h>
42 #define URI_STR_PROPERTY_COUNT Uri_PROPERTY_STRING_LAST+1
43 #define URI_DWORD_PROPERTY_COUNT (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1
45 static HRESULT (WINAPI *pCreateUri)(LPCWSTR, DWORD, DWORD_PTR, IUri**);
47 static const WCHAR http_urlW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
48 '.','o','r','g','/',0};
50 typedef struct _uri_create_flag_test {
53 } uri_create_flag_test;
55 static const uri_create_flag_test invalid_flag_tests[] = {
56 /* Set of invalid flag combinations to test for. */
57 {Uri_CREATE_DECODE_EXTRA_INFO | Uri_CREATE_NO_DECODE_EXTRA_INFO, E_INVALIDARG},
58 {Uri_CREATE_CANONICALIZE | Uri_CREATE_NO_CANONICALIZE, E_INVALIDARG},
59 {Uri_CREATE_CRACK_UNKNOWN_SCHEMES | Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, E_INVALIDARG},
60 {Uri_CREATE_PRE_PROCESS_HTML_URI | Uri_CREATE_NO_PRE_PROCESS_HTML_URI, E_INVALIDARG},
61 {Uri_CREATE_IE_SETTINGS | Uri_CREATE_NO_IE_SETTINGS, E_INVALIDARG}
64 typedef struct _uri_str_property {
70 typedef struct _uri_dword_property {
76 typedef struct _uri_properties {
79 HRESULT create_expected;
84 uri_str_property str_props[URI_STR_PROPERTY_COUNT];
85 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
88 static const uri_properties uri_tests[] = {
89 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK, FALSE,
90 /* A flag bitmap containing all the Uri_HAS_* flags that correspond to this uri. */
91 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|Uri_HAS_HOST|
92 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|
93 Uri_HAS_PORT|Uri_HAS_SCHEME,
96 {"http://www.winehq.org/",S_OK,TRUE}, /* ABSOLUTE_URI */
97 {"www.winehq.org",S_OK,TRUE}, /* AUTHORITY */
98 {"http://www.winehq.org/",S_OK,TRUE}, /* DISPLAY_URI */
99 {"winehq.org",S_OK,TRUE}, /* DOMAIN */
100 {"",S_FALSE,TRUE}, /* EXTENSION */
101 {"",S_FALSE,TRUE}, /* FRAGMENT */
102 {"www.winehq.org",S_OK,TRUE}, /* HOST */
103 {"",S_FALSE,FALSE}, /* PASSWORD */
104 {"/",S_OK,TRUE}, /* PATH */
105 {"/",S_OK,TRUE}, /* PATH_AND_QUERY */
106 {"",S_FALSE,TRUE}, /* QUERY */
107 {"http://www.winehq.org/tests/../tests/../..",S_OK,FALSE}, /* RAW_URI */
108 {"http",S_OK,FALSE}, /* SCHEME_NAME */
109 {"",S_FALSE,FALSE}, /* USER_INFO */
110 {"",S_FALSE,FALSE} /* USER_NAME */
113 {Uri_HOST_DNS,S_OK,TRUE}, /* HOST_TYPE */
114 {80,S_OK,TRUE}, /* PORT */
115 {URL_SCHEME_HTTP,S_OK,FALSE}, /* SCHEME */
116 {URLZONE_INVALID,E_NOTIMPL,FALSE} /* ZONE */
119 { "http://winehq.org/tests/.././tests", 0, S_OK, FALSE,
120 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|Uri_HAS_HOST|
121 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|
122 Uri_HAS_PORT|Uri_HAS_SCHEME,
125 {"http://winehq.org/tests",S_OK,TRUE},
126 {"winehq.org",S_OK,TRUE},
127 {"http://winehq.org/tests",S_OK,TRUE},
128 {"winehq.org",S_OK,TRUE},
131 {"winehq.org",S_OK,TRUE},
133 {"/tests",S_OK,TRUE},
134 {"/tests",S_OK,TRUE},
136 {"http://winehq.org/tests/.././tests",S_OK,FALSE},
142 {Uri_HOST_DNS,S_OK,TRUE},
144 {URL_SCHEME_HTTP,S_OK,FALSE},
145 {URLZONE_INVALID,E_NOTIMPL,FALSE}
148 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
149 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|Uri_HAS_HOST|
150 Uri_HAS_DOMAIN|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_QUERY|Uri_HAS_RAW_URI|
151 Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
154 {"http://www.winehq.org/?query=x&return=y",S_OK,TRUE},
155 {"www.winehq.org",S_OK,TRUE},
156 {"http://www.winehq.org/?query=x&return=y",S_OK,TRUE},
157 {"winehq.org",S_OK,TRUE},
160 {"www.winehq.org",S_OK,TRUE},
163 {"/?query=x&return=y",S_OK,TRUE},
164 {"?query=x&return=y",S_OK,TRUE},
165 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
171 {Uri_HOST_DNS,S_OK,TRUE},
173 {URL_SCHEME_HTTP,S_OK,FALSE},
174 {URLZONE_INVALID,E_NOTIMPL,FALSE},
177 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK, FALSE,
178 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|Uri_HAS_HOST|Uri_HAS_PATH|
179 Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|Uri_HAS_USER_INFO|Uri_HAS_USER_NAME|
180 Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
183 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,TRUE},
184 {"usEr%3Ainfo@example.com",S_OK,TRUE},
185 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,TRUE},
186 {"example.com",S_OK,TRUE},
189 {"example.com",S_OK,TRUE},
191 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,TRUE},
192 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,TRUE},
194 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK,FALSE},
196 {"usEr%3Ainfo",S_OK,FALSE},
197 {"usEr%3Ainfo",S_OK,FALSE}
200 {Uri_HOST_DNS,S_OK,TRUE},
202 {URL_SCHEME_HTTP,S_OK,FALSE},
203 {URLZONE_INVALID,E_NOTIMPL,FALSE},
206 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK, FALSE,
207 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|Uri_HAS_EXTENSION|
208 Uri_HAS_HOST|Uri_HAS_PASSWORD|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|
209 Uri_HAS_SCHEME_NAME|Uri_HAS_USER_INFO|Uri_HAS_USER_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_PORT|
213 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,TRUE},
214 {"winepass:wine@ftp.winehq.org:9999",S_OK,TRUE},
215 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,TRUE},
216 {"winehq.org",S_OK,TRUE},
219 {"ftp.winehq.org",S_OK,TRUE},
221 {"/dir/foo%20bar.txt",S_OK,TRUE},
222 {"/dir/foo%20bar.txt",S_OK,TRUE},
224 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK,FALSE},
226 {"winepass:wine",S_OK,FALSE},
227 {"winepass",S_OK,FALSE}
230 {Uri_HOST_DNS,S_OK,TRUE},
232 {URL_SCHEME_FTP,S_OK,FALSE},
233 {URLZONE_INVALID,E_NOTIMPL,FALSE}
236 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK, FALSE,
237 Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_EXTENSION|Uri_HAS_PATH|
238 Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME,
241 {"file:///c:/tests/foo%2520bar.mp3",S_OK,TRUE},
243 {"file:///c:/tests/foo%2520bar.mp3",S_OK,TRUE},
249 {"/c:/tests/foo%2520bar.mp3",S_OK,TRUE},
250 {"/c:/tests/foo%2520bar.mp3",S_OK,TRUE},
252 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
258 {Uri_HOST_UNKNOWN,S_OK,TRUE},
260 {URL_SCHEME_FILE,S_OK,FALSE},
261 {URLZONE_INVALID,E_NOTIMPL,FALSE}
264 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK, FALSE,
265 Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_EXTENSION|Uri_HAS_PATH|
266 Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME,
269 {"file:///tests/test%20file.README.txt",S_OK,TRUE},
271 {"file:///tests/test%20file.README.txt",S_OK,TRUE},
277 {"/tests/test%20file.README.txt",S_OK,TRUE},
278 {"/tests/test%20file.README.txt",S_OK,TRUE},
280 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,FALSE},
286 {Uri_HOST_UNKNOWN,S_OK,TRUE},
288 {URL_SCHEME_FILE,S_OK,FALSE},
289 {URLZONE_INVALID,E_NOTIMPL,FALSE}
292 { "urn:nothing:should:happen here", 0, S_OK, FALSE,
293 Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|
294 Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME,
297 {"urn:nothing:should:happen here",S_OK,TRUE},
299 {"urn:nothing:should:happen here",S_OK,TRUE},
305 {"nothing:should:happen here",S_OK,TRUE},
306 {"nothing:should:happen here",S_OK,TRUE},
308 {"urn:nothing:should:happen here",S_OK,FALSE},
314 {Uri_HOST_UNKNOWN,S_OK,TRUE},
316 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
317 {URLZONE_INVALID,E_NOTIMPL,FALSE}
320 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK, FALSE,
321 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_EXTENSION|
322 Uri_HAS_HOST|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
323 Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
326 {"http://127.0.0.1/test%20dir/test.txt",S_OK,TRUE},
327 {"127.0.0.1",S_OK,TRUE},
328 {"http://127.0.0.1/test%20dir/test.txt",S_OK,TRUE},
332 {"127.0.0.1",S_OK,FALSE},
334 {"/test%20dir/test.txt",S_OK,TRUE},
335 {"/test%20dir/test.txt",S_OK,TRUE},
337 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
343 {Uri_HOST_IPV4,S_OK,TRUE},
345 {URL_SCHEME_HTTP,S_OK,FALSE},
346 {URLZONE_INVALID,E_NOTIMPL,FALSE}
349 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK, FALSE,
350 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
351 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
352 Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
355 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,TRUE},
356 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,TRUE},
357 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,TRUE},
361 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,TRUE},
366 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
372 {Uri_HOST_IPV6,S_OK,TRUE},
374 {URL_SCHEME_HTTP,S_OK,FALSE},
375 {URLZONE_INVALID,E_NOTIMPL,FALSE}
378 { "ftp://[::13.1.68.3]", 0, S_OK, FALSE,
379 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
380 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
381 Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
384 {"ftp://[::13.1.68.3]/",S_OK,TRUE},
385 {"[::13.1.68.3]",S_OK,TRUE},
386 {"ftp://[::13.1.68.3]/",S_OK,TRUE},
390 {"::13.1.68.3",S_OK,TRUE},
395 {"ftp://[::13.1.68.3]",S_OK,FALSE},
401 {Uri_HOST_IPV6,S_OK,TRUE},
403 {URL_SCHEME_FTP,S_OK,FALSE},
404 {URLZONE_INVALID,E_NOTIMPL,FALSE}
407 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK, FALSE,
408 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
409 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
410 Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
413 {"http://[fedc:ba98::3210]/",S_OK,TRUE},
414 {"[fedc:ba98::3210]",S_OK,TRUE},
415 {"http://[fedc:ba98::3210]/",S_OK,TRUE},
419 {"fedc:ba98::3210",S_OK,TRUE},
424 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
430 {Uri_HOST_IPV6,S_OK,TRUE},
432 {URL_SCHEME_HTTP,S_OK,FALSE},
433 {URLZONE_INVALID,E_NOTIMPL,FALSE}
436 { "1234://www.winehq.org", 0, S_OK, FALSE,
437 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|
438 Uri_HAS_HOST|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
439 Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME,
442 {"1234://www.winehq.org/",S_OK,TRUE},
443 {"www.winehq.org",S_OK,TRUE},
444 {"1234://www.winehq.org/",S_OK,TRUE},
445 {"winehq.org",S_OK,TRUE},
448 {"www.winehq.org",S_OK,TRUE},
453 {"1234://www.winehq.org",S_OK,FALSE},
459 {Uri_HOST_DNS,S_OK,TRUE},
461 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
462 {URLZONE_INVALID,E_NOTIMPL,FALSE}
465 { "://www.winehq.org", 0, E_INVALIDARG, FALSE,
485 {Uri_HOST_UNKNOWN,S_FALSE,TRUE},
487 {URL_SCHEME_UNKNOWN,S_FALSE,FALSE},
488 {URLZONE_INVALID,E_NOTIMPL,FALSE}
491 /* Window's doesn't like URI's which are implicitly file paths without the ALLOW_IMPLICIT_FILE_SCHEME flag set. */
492 { "C:/test/test.mp3", 0, E_INVALIDARG, FALSE,
512 {Uri_HOST_UNKNOWN,S_FALSE,FALSE},
514 {URL_SCHEME_INVALID,S_FALSE,FALSE},
515 {URLZONE_INVALID,E_NOTIMPL,FALSE}
518 /* Window's doesn't like URI's which are implicitly file paths without the ALLOW_IMPLICIT_FILE_SCHEME flag set. */
519 { "\\\\Server/test/test.mp3", 0, E_INVALIDARG, FALSE,
539 {Uri_HOST_UNKNOWN,S_FALSE,FALSE},
541 {URL_SCHEME_INVALID,S_FALSE,FALSE},
542 {URLZONE_INVALID,E_NOTIMPL,FALSE}
545 /* Window's doesn't like URI's which are implicitly file paths without the ALLOW_IMPLICIT_FILE_SCHEME flag set. */
546 { "\\\\Server/test/test.mp3", Uri_CREATE_ALLOW_RELATIVE, E_INVALIDARG, FALSE,
566 {Uri_HOST_UNKNOWN,S_FALSE,FALSE},
568 {URL_SCHEME_INVALID,S_FALSE,FALSE},
569 {URLZONE_INVALID,E_NOTIMPL,FALSE}
572 /* Window's doesn't like URI's which are implicitly file paths without the ALLOW_IMPLICIT_FILE_SCHEME flag set. */
573 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, E_INVALIDARG, FALSE,
593 {Uri_HOST_UNKNOWN,S_FALSE,FALSE},
595 {URL_SCHEME_INVALID,S_FALSE,FALSE},
596 {URLZONE_INVALID,E_NOTIMPL,FALSE}
599 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
600 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
601 Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_EXTENSION|Uri_HAS_PATH|
602 Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME,
605 {"file:///C:/test/test.mp3",S_OK,TRUE},
607 {"file:///C:/test/test.mp3",S_OK,TRUE},
613 {"/C:/test/test.mp3",S_OK,TRUE},
614 {"/C:/test/test.mp3",S_OK,TRUE},
616 {"C:/test/test.mp3",S_OK,FALSE},
622 {Uri_HOST_UNKNOWN,S_OK,TRUE},
624 {URL_SCHEME_FILE,S_OK,FALSE},
625 {URLZONE_INVALID,E_NOTIMPL,FALSE}
628 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
629 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
630 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_EXTENSION|
631 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_HOST|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
632 Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME,
635 {"file://server/test.mp3",S_OK,TRUE},
636 {"server",S_OK,TRUE},
637 {"file://server/test.mp3",S_OK,TRUE},
641 {"server",S_OK,TRUE},
643 {"/test.mp3",S_OK,TRUE},
644 {"/test.mp3",S_OK,TRUE},
646 {"\\\\Server/test.mp3",S_OK,FALSE},
652 {Uri_HOST_DNS,S_OK,TRUE},
654 {URL_SCHEME_FILE,S_OK,FALSE},
655 {URLZONE_INVALID,E_NOTIMPL,FALSE}
658 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
659 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|Uri_HAS_HOST|
660 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|
664 {"*:www.winehq.org/test",S_OK,TRUE},
665 {"www.winehq.org",S_OK,TRUE},
666 {"*:www.winehq.org/test",S_OK,TRUE},
667 {"winehq.org",S_OK,TRUE},
670 {"www.winehq.org",S_OK,TRUE},
675 {"www.winehq.org/test",S_OK,FALSE},
681 {Uri_HOST_DNS,S_OK,TRUE},
683 {URL_SCHEME_WILDCARD,S_OK,FALSE},
684 {URLZONE_INVALID,E_NOTIMPL,FALSE}
687 /* Valid since the '*' is the only character in the scheme name. */
688 { "*:www.winehq.org/test", 0, S_OK, FALSE,
689 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|Uri_HAS_HOST|
690 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|
694 {"*:www.winehq.org/test",S_OK,TRUE},
695 {"www.winehq.org",S_OK,TRUE},
696 {"*:www.winehq.org/test",S_OK,TRUE},
697 {"winehq.org",S_OK,TRUE},
700 {"www.winehq.org",S_OK,TRUE},
705 {"*:www.winehq.org/test",S_OK,FALSE},
711 {Uri_HOST_DNS,S_OK,TRUE},
713 {URL_SCHEME_WILDCARD,S_OK,FALSE},
714 {URLZONE_INVALID,E_NOTIMPL,FALSE}
717 /* Not valid since a '*' is only allowed to appear if its the only character in scheme. */
718 { "*abcd://not.valid.com", 0, E_INVALIDARG, FALSE,
738 {Uri_HOST_UNKNOWN,S_FALSE,FALSE},
740 {URL_SCHEME_INVALID,S_FALSE,FALSE},
741 {URLZONE_INVALID,E_NOTIMPL,FALSE}
744 /* Not valid since a '*' is only allowed to appear if its the only character in scheme. */
745 { "*a*b*c*d://not.valid.com", 0, E_INVALIDARG, FALSE,
765 {Uri_HOST_UNKNOWN,S_FALSE,FALSE},
767 {URL_SCHEME_INVALID,S_FALSE,FALSE},
768 {URLZONE_INVALID,E_NOTIMPL,FALSE}
771 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
772 Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_EXTENSION|Uri_HAS_PATH|
773 Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME,
776 {"/../some dir/test.ext",S_OK,TRUE},
778 {"/../some dir/test.ext",S_OK,TRUE},
784 {"/../some dir/test.ext",S_OK,TRUE},
785 {"/../some dir/test.ext",S_OK,TRUE},
787 {"/../some dir/test.ext",S_OK,FALSE},
793 {Uri_HOST_UNKNOWN,S_OK,TRUE},
795 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
796 {URLZONE_INVALID,E_NOTIMPL,FALSE}
799 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
800 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|Uri_HAS_PATH|
801 Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME,
804 {"*://implicit/wildcard/uri%20scheme",S_OK,TRUE},
806 {"*://implicit/wildcard/uri%20scheme",S_OK,TRUE},
812 {"//implicit/wildcard/uri%20scheme",S_OK,TRUE},
813 {"//implicit/wildcard/uri%20scheme",S_OK,TRUE},
815 {"//implicit/wildcard/uri scheme",S_OK,FALSE},
821 {Uri_HOST_UNKNOWN,S_OK,TRUE},
823 {URL_SCHEME_WILDCARD,S_OK,FALSE},
824 {URLZONE_INVALID,E_NOTIMPL,FALSE}
827 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and its an unknown scheme. */
828 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, S_OK, FALSE,
829 Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_EXTENSION|Uri_HAS_PATH|
830 Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME_NAME|
834 {"zip:/.//google.com",S_OK,TRUE},
836 {"zip:/.//google.com",S_OK,TRUE},
842 {"/.//google.com",S_OK,TRUE},
843 {"/.//google.com",S_OK,TRUE},
845 {"zip://google.com",S_OK,FALSE},
851 {Uri_HOST_UNKNOWN,S_OK,TRUE},
853 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
854 {URLZONE_INVALID,E_NOTIMPL,FALSE}
857 /* Windows uses the first occurence of ':' to delimit the userinfo. */
858 { "ftp://user:pass:word@winehq.org/", 0, S_OK, FALSE,
859 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|
860 Uri_HAS_HOST|Uri_HAS_PASSWORD|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|
861 Uri_HAS_SCHEME_NAME|Uri_HAS_USER_INFO|Uri_HAS_USER_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_PORT|
865 {"ftp://user:pass:word@winehq.org/",S_OK,TRUE},
866 {"user:pass:word@winehq.org",S_OK,TRUE},
867 {"ftp://winehq.org/",S_OK,TRUE},
868 {"winehq.org",S_OK,TRUE},
871 {"winehq.org",S_OK,TRUE},
872 {"pass:word",S_OK,FALSE},
876 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
878 {"user:pass:word",S_OK,FALSE},
882 {Uri_HOST_DNS,S_OK,TRUE},
884 {URL_SCHEME_FTP,S_OK,FALSE},
885 {URLZONE_INVALID,E_NOTIMPL,FALSE}
888 /* Make sure % encoded unreserved characters are decoded. */
889 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK, FALSE,
890 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|
891 Uri_HAS_HOST|Uri_HAS_PASSWORD|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|
892 Uri_HAS_SCHEME_NAME|Uri_HAS_USER_INFO|Uri_HAS_USER_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_PORT|
896 {"ftp://wINe:PASS@ftp.google.com/",S_OK,TRUE},
897 {"wINe:PASS@ftp.google.com",S_OK,TRUE},
898 {"ftp://ftp.google.com/",S_OK,TRUE},
899 {"google.com",S_OK,TRUE},
902 {"ftp.google.com",S_OK,TRUE},
907 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK,FALSE},
909 {"wINe:PASS",S_OK,FALSE},
913 {Uri_HOST_DNS,S_OK,TRUE},
915 {URL_SCHEME_FTP,S_OK,FALSE},
916 {URLZONE_INVALID,E_NOTIMPL,FALSE}
919 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
920 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK, FALSE,
921 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|
922 Uri_HAS_HOST|Uri_HAS_PASSWORD|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|
923 Uri_HAS_SCHEME_NAME|Uri_HAS_USER_INFO|Uri_HAS_USER_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_PORT|
927 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,TRUE},
928 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK,TRUE},
929 {"ftp://ftp.google.com/",S_OK,TRUE},
930 {"google.com",S_OK,TRUE},
933 {"ftp.google.com",S_OK,TRUE},
934 {"PA%7B%7D",S_OK,FALSE},
938 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
940 {"w%5D%5Be:PA%7B%7D",S_OK,FALSE},
941 {"w%5D%5Be",S_OK,FALSE}
944 {Uri_HOST_DNS,S_OK,TRUE},
946 {URL_SCHEME_FTP,S_OK,FALSE},
947 {URLZONE_INVALID,E_NOTIMPL,FALSE}
950 /* You're allowed to have an empty password portion in the userinfo section. */
951 { "ftp://empty:@ftp.google.com/", 0, S_OK, FALSE,
952 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|
953 Uri_HAS_HOST|Uri_HAS_PASSWORD|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|
954 Uri_HAS_SCHEME_NAME|Uri_HAS_USER_INFO|Uri_HAS_USER_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_PORT|
958 {"ftp://empty:@ftp.google.com/",S_OK,TRUE},
959 {"empty:@ftp.google.com",S_OK,TRUE},
960 {"ftp://ftp.google.com/",S_OK,TRUE},
961 {"google.com",S_OK,TRUE},
964 {"ftp.google.com",S_OK,TRUE},
969 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
971 {"empty:",S_OK,FALSE},
975 {Uri_HOST_DNS,S_OK,TRUE},
977 {URL_SCHEME_FTP,S_OK,FALSE},
978 {URLZONE_INVALID,E_NOTIMPL,FALSE}
981 /* Make sure forbidden characters in "userinfo" get encoded. */
982 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK, FALSE,
983 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|
984 Uri_HAS_HOST|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|
985 Uri_HAS_SCHEME_NAME|Uri_HAS_USER_INFO|Uri_HAS_USER_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_PORT|
989 {"ftp://%22%20%22weird@ftp.google.com/",S_OK,TRUE},
990 {"%22%20%22weird@ftp.google.com",S_OK,TRUE},
991 {"ftp://ftp.google.com/",S_OK,TRUE},
992 {"google.com",S_OK,TRUE},
995 {"ftp.google.com",S_OK,TRUE},
1000 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
1002 {"%22%20%22weird",S_OK,FALSE},
1003 {"%22%20%22weird",S_OK,FALSE}
1006 {Uri_HOST_DNS,S_OK,TRUE},
1008 {URL_SCHEME_FTP,S_OK,FALSE},
1009 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1012 /* Make sure the forbidden characters don't get percent encoded. */
1013 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
1014 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|
1015 Uri_HAS_HOST|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|
1016 Uri_HAS_SCHEME_NAME|Uri_HAS_USER_INFO|Uri_HAS_USER_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_PORT|
1020 {"ftp://\" \"weird@ftp.google.com/",S_OK,TRUE},
1021 {"\" \"weird@ftp.google.com",S_OK,TRUE},
1022 {"ftp://ftp.google.com/",S_OK,TRUE},
1023 {"google.com",S_OK,TRUE},
1026 {"ftp.google.com",S_OK,TRUE},
1031 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
1033 {"\" \"weird",S_OK,FALSE},
1034 {"\" \"weird",S_OK,FALSE}
1037 {Uri_HOST_DNS,S_OK,TRUE},
1039 {URL_SCHEME_FTP,S_OK,FALSE},
1040 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1043 /* Allowed to have invalid % encoded because its an unknown scheme type. */
1044 { "zip://%xy:word@winehq.org/", 0, S_OK, FALSE,
1045 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|
1046 Uri_HAS_HOST|Uri_HAS_PASSWORD|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|
1047 Uri_HAS_SCHEME_NAME|Uri_HAS_USER_INFO|Uri_HAS_USER_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME,
1050 {"zip://%xy:word@winehq.org/",S_OK,TRUE},
1051 {"%xy:word@winehq.org",S_OK,TRUE},
1052 {"zip://%xy:word@winehq.org/",S_OK,TRUE},
1053 {"winehq.org",S_OK,TRUE},
1056 {"winehq.org",S_OK,TRUE},
1057 {"word",S_OK,FALSE},
1061 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
1063 {"%xy:word",S_OK,FALSE},
1067 {Uri_HOST_DNS,S_OK,TRUE},
1069 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1070 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1073 /* Unreserved, percent encoded characters aren't decoded in the userinfo becuase the scheme
1076 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK, FALSE,
1077 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|
1078 Uri_HAS_HOST|Uri_HAS_PASSWORD|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|
1079 Uri_HAS_SCHEME_NAME|Uri_HAS_USER_INFO|Uri_HAS_USER_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME,
1082 {"zip://%2E:%52%53ord@winehq.org/",S_OK,TRUE},
1083 {"%2E:%52%53ord@winehq.org",S_OK,TRUE},
1084 {"zip://%2E:%52%53ord@winehq.org/",S_OK,TRUE},
1085 {"winehq.org",S_OK,TRUE},
1088 {"winehq.org",S_OK,TRUE},
1089 {"%52%53ord",S_OK,FALSE},
1093 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
1095 {"%2E:%52%53ord",S_OK,FALSE},
1099 {Uri_HOST_DNS,S_OK,TRUE},
1101 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1102 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1105 { "ftp://[](),'test':word@winehq.org/", 0, S_OK, FALSE,
1106 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|
1107 Uri_HAS_HOST|Uri_HAS_PASSWORD|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|
1108 Uri_HAS_SCHEME_NAME|Uri_HAS_USER_INFO|Uri_HAS_USER_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_PORT|
1112 {"ftp://[](),'test':word@winehq.org/",S_OK,TRUE},
1113 {"[](),'test':word@winehq.org",S_OK,TRUE},
1114 {"ftp://winehq.org/",S_OK,TRUE},
1115 {"winehq.org",S_OK,TRUE},
1118 {"winehq.org",S_OK,TRUE},
1119 {"word",S_OK,FALSE},
1123 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
1125 {"[](),'test':word",S_OK,FALSE},
1126 {"[](),'test'",S_OK,FALSE}
1129 {Uri_HOST_DNS,S_OK,TRUE},
1131 {URL_SCHEME_FTP,S_OK,FALSE},
1132 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1135 { "ftp://test?:word@winehq.org/", 0, S_OK, FALSE,
1136 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
1137 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
1138 Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
1141 {"ftp://test/?:word@winehq.org/",S_OK,TRUE},
1143 {"ftp://test/?:word@winehq.org/",S_OK,TRUE},
1150 {"/?:word@winehq.org/",S_OK,TRUE},
1151 {"?:word@winehq.org/",S_OK,TRUE},
1152 {"ftp://test?:word@winehq.org/",S_OK,FALSE},
1158 {Uri_HOST_DNS,S_OK,TRUE},
1160 {URL_SCHEME_FTP,S_OK,FALSE},
1161 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1164 { "ftp://test#:word@winehq.org/", 0, S_OK, FALSE,
1165 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_FRAGMENT|Uri_HAS_HOST|
1166 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
1167 Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
1170 {"ftp://test/#:word@winehq.org/",S_OK,TRUE},
1172 {"ftp://test/#:word@winehq.org/",S_OK,TRUE},
1175 {"#:word@winehq.org/",S_OK,TRUE},
1181 {"ftp://test#:word@winehq.org/",S_OK,FALSE},
1187 {Uri_HOST_DNS,S_OK,TRUE},
1189 {URL_SCHEME_FTP,S_OK,FALSE},
1190 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1193 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
1194 { "zip://test\\:word@winehq.org/", 0, S_OK, FALSE,
1195 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|Uri_HAS_HOST|
1196 Uri_HAS_PASSWORD|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
1197 Uri_HAS_USER_INFO|Uri_HAS_USER_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME,
1200 {"zip://test\\:word@winehq.org/",S_OK,TRUE},
1201 {"test\\:word@winehq.org",S_OK,TRUE},
1202 {"zip://test\\:word@winehq.org/",S_OK,TRUE},
1203 {"winehq.org",S_OK,TRUE},
1206 {"winehq.org",S_OK,TRUE},
1207 {"word",S_OK,FALSE},
1211 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1213 {"test\\:word",S_OK,FALSE},
1214 {"test\\",S_OK,FALSE}
1217 {Uri_HOST_DNS,S_OK,TRUE},
1219 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1220 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1223 /* It normalizes IPv4 addresses correctly. */
1224 { "http://127.000.000.100/", 0, S_OK, FALSE,
1225 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
1226 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
1227 Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
1230 {"http://127.0.0.100/",S_OK,TRUE},
1231 {"127.0.0.100",S_OK,TRUE},
1232 {"http://127.0.0.100/",S_OK,TRUE},
1236 {"127.0.0.100",S_OK,FALSE},
1241 {"http://127.000.000.100/",S_OK,FALSE},
1242 {"http",S_OK,FALSE},
1247 {Uri_HOST_IPV4,S_OK,TRUE},
1249 {URL_SCHEME_HTTP,S_OK,FALSE},
1250 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1253 /* Make sure it normalizes partial IPv4 addresses correctly. */
1254 { "http://127.0/", 0, S_OK, FALSE,
1255 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
1256 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
1257 Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
1260 {"http://127.0.0.0/",S_OK,TRUE},
1261 {"127.0.0.0",S_OK,TRUE},
1262 {"http://127.0.0.0/",S_OK,TRUE},
1266 {"127.0.0.0",S_OK,FALSE},
1271 {"http://127.0/",S_OK,FALSE},
1272 {"http",S_OK,FALSE},
1277 {Uri_HOST_IPV4,S_OK,TRUE},
1279 {URL_SCHEME_HTTP,S_OK,FALSE},
1280 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1283 /* Make sure it converts implicit IPv4's correctly. */
1284 { "http://123456/", 0, S_OK, FALSE,
1285 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
1286 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
1287 Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
1290 {"http://0.1.226.64/",S_OK,TRUE},
1291 {"0.1.226.64",S_OK,TRUE},
1292 {"http://0.1.226.64/",S_OK,TRUE},
1296 {"0.1.226.64",S_OK,FALSE},
1301 {"http://123456/",S_OK,FALSE},
1302 {"http",S_OK,FALSE},
1307 {Uri_HOST_IPV4,S_OK,TRUE},
1309 {URL_SCHEME_HTTP,S_OK,FALSE},
1310 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1314 { "http://4294967295/", 0, S_OK, FALSE,
1315 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
1316 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
1317 Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
1320 {"http://255.255.255.255/",S_OK,TRUE},
1321 {"255.255.255.255",S_OK,TRUE},
1322 {"http://255.255.255.255/",S_OK,TRUE},
1326 {"255.255.255.255",S_OK,FALSE},
1331 {"http://4294967295/",S_OK,FALSE},
1332 {"http",S_OK,FALSE},
1337 {Uri_HOST_IPV4,S_OK,TRUE},
1339 {URL_SCHEME_HTTP,S_OK,FALSE},
1340 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1344 { "http://4294967296/", 0, S_OK, FALSE,
1345 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
1346 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
1347 Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
1350 {"http://4294967296/",S_OK,TRUE},
1351 {"4294967296",S_OK,TRUE},
1352 {"http://4294967296/",S_OK,TRUE},
1356 {"4294967296",S_OK,TRUE},
1361 {"http://4294967296/",S_OK,FALSE},
1362 {"http",S_OK,FALSE},
1367 {Uri_HOST_DNS,S_OK,TRUE},
1369 {URL_SCHEME_HTTP,S_OK,FALSE},
1370 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1373 /* Window's doesn't normalize IP address for unknown schemes. */
1374 { "1234://4294967295/", 0, S_OK, FALSE,
1375 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
1376 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
1377 Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME,
1380 {"1234://4294967295/",S_OK,TRUE},
1381 {"4294967295",S_OK,TRUE},
1382 {"1234://4294967295/",S_OK,TRUE},
1386 {"4294967295",S_OK,FALSE},
1391 {"1234://4294967295/",S_OK,FALSE},
1392 {"1234",S_OK,FALSE},
1397 {Uri_HOST_IPV4,S_OK,TRUE},
1399 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1400 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1403 /* Window's doesn't normalize IP address for unknown schemes. */
1404 { "1234://127.001/", 0, S_OK, FALSE,
1405 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
1406 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
1407 Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME,
1410 {"1234://127.001/",S_OK,TRUE},
1411 {"127.001",S_OK,TRUE},
1412 {"1234://127.001/",S_OK,TRUE},
1416 {"127.001",S_OK,FALSE},
1421 {"1234://127.001/",S_OK,FALSE},
1422 {"1234",S_OK,FALSE},
1427 {Uri_HOST_IPV4,S_OK,TRUE},
1429 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1430 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1433 { "http://[FEDC:BA98::3210]", 0, S_OK, FALSE,
1434 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
1435 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
1436 Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
1439 {"http://[fedc:ba98::3210]/",S_OK,TRUE},
1440 {"[fedc:ba98::3210]",S_OK,TRUE},
1441 {"http://[fedc:ba98::3210]/",S_OK,TRUE},
1445 {"fedc:ba98::3210",S_OK,TRUE},
1450 {"http://[FEDC:BA98::3210]",S_OK,FALSE},
1451 {"http",S_OK,FALSE},
1456 {Uri_HOST_IPV6,S_OK,TRUE},
1458 {URL_SCHEME_HTTP,S_OK,FALSE},
1459 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1462 { "http://[::]", 0, S_OK, FALSE,
1463 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
1464 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
1465 Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
1468 {"http://[::]/",S_OK,TRUE},
1470 {"http://[::]/",S_OK,TRUE},
1479 {"http://[::]",S_OK,FALSE},
1480 {"http",S_OK,FALSE},
1485 {Uri_HOST_IPV6,S_OK,TRUE},
1487 {URL_SCHEME_HTTP,S_OK,FALSE},
1488 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1491 { "http://[FEDC:BA98::]", 0, S_OK, FALSE,
1492 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
1493 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
1494 Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
1497 {"http://[fedc:ba98::]/",S_OK,TRUE},
1498 {"[fedc:ba98::]",S_OK,TRUE},
1499 {"http://[fedc:ba98::]/",S_OK,TRUE},
1503 {"fedc:ba98::",S_OK,TRUE},
1508 {"http://[FEDC:BA98::]",S_OK,FALSE},
1509 {"http",S_OK,FALSE},
1514 {Uri_HOST_IPV6,S_OK,TRUE},
1516 {URL_SCHEME_HTTP,S_OK,FALSE},
1517 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1520 /* Too many h16 components. */
1521 { "http://[1:2:3:4:5:6:7:8:9]", 0, E_INVALIDARG, FALSE,
1542 {Uri_HOST_UNKNOWN,S_FALSE,FALSE},
1544 {URL_SCHEME_INVALID,S_FALSE,FALSE},
1545 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1548 /* Not enough room for IPv4 address. */
1549 { "http://[1:2:3:4:5:6:7:192.0.1.0]", 0, E_INVALIDARG, FALSE,
1570 {Uri_HOST_UNKNOWN,S_FALSE,FALSE},
1572 {URL_SCHEME_INVALID,S_FALSE,FALSE},
1573 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1576 /* Not enough h16 component */
1577 { "http://[1:2:3:4]", 0, E_INVALIDARG, FALSE,
1598 {Uri_HOST_UNKNOWN,S_FALSE,FALSE},
1600 {URL_SCHEME_INVALID,S_FALSE,FALSE},
1601 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1604 /* Not enough components including IPv4 address. */
1605 { "http://[1:192.0.1.0]", 0, E_INVALIDARG, FALSE,
1626 {Uri_HOST_UNKNOWN,S_FALSE,FALSE},
1628 {URL_SCHEME_INVALID,S_FALSE,FALSE},
1629 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1632 /* Not valid to have a partial IPv4 address in a IPv6 address. */
1633 { "http://[::192.0]", 0, E_INVALIDARG, FALSE,
1654 {Uri_HOST_UNKNOWN,S_FALSE,FALSE},
1656 {URL_SCHEME_INVALID,S_FALSE,FALSE},
1657 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1660 /* Not valid because a elision of 2 bytes appears at the beginning of address. */
1661 { "http://[::2:3:4:5:6:7:8]", 0, E_INVALIDARG, FALSE,
1682 {Uri_HOST_UNKNOWN,S_FALSE,FALSE},
1684 {URL_SCHEME_INVALID,S_FALSE,FALSE},
1685 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1688 /* Not valid because a elision of 2 bytes appears at the end of address. */
1689 { "http://[1:2:3:4:5:6:7::]", 0, E_INVALIDARG, FALSE,
1710 {Uri_HOST_UNKNOWN,S_FALSE,FALSE},
1712 {URL_SCHEME_INVALID,S_FALSE,FALSE},
1713 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1716 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1717 { "http://[1::3:4:5:6:7:8]", 0, S_OK, FALSE,
1718 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
1719 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
1720 Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
1723 {"http://[1:0:3:4:5:6:7:8]/",S_OK,TRUE},
1724 {"[1:0:3:4:5:6:7:8]",S_OK,TRUE},
1725 {"http://[1:0:3:4:5:6:7:8]/",S_OK,TRUE},
1729 {"1:0:3:4:5:6:7:8",S_OK,TRUE},
1734 {"http://[1::3:4:5:6:7:8]",S_OK,FALSE},
1735 {"http",S_OK,FALSE},
1740 {Uri_HOST_IPV6,S_OK,TRUE},
1742 {URL_SCHEME_HTTP,S_OK,FALSE},
1743 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1746 { "http://[v2.34]/", 0, S_OK, FALSE,
1747 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
1748 Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
1749 Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
1752 {"http://[v2.34]/",S_OK,TRUE},
1753 {"[v2.34]",S_OK,TRUE},
1754 {"http://[v2.34]/",S_OK,TRUE},
1758 {"[v2.34]",S_OK,TRUE},
1763 {"http://[v2.34]/",S_OK,FALSE},
1764 {"http",S_OK,FALSE},
1769 {Uri_HOST_UNKNOWN,S_OK,TRUE},
1771 {URL_SCHEME_HTTP,S_OK,FALSE},
1772 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1775 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1776 { "http://[xyz:12345.com/test", 0, S_OK, FALSE,
1777 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|
1778 Uri_HAS_HOST|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|
1779 Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
1782 {"http://[xyz:12345.com/test",S_OK,TRUE},
1783 {"[xyz:12345.com",S_OK,TRUE},
1784 {"http://[xyz:12345.com/test",S_OK,TRUE},
1785 {"[xyz:12345.com",S_OK,TRUE},
1788 {"[xyz:12345.com",S_OK,TRUE},
1790 {"/test",S_OK,TRUE},
1791 {"/test",S_OK,TRUE},
1793 {"http://[xyz:12345.com/test",S_OK,FALSE},
1794 {"http",S_OK,FALSE},
1799 {Uri_HOST_DNS,S_OK,TRUE},
1801 {URL_SCHEME_HTTP,S_OK,FALSE},
1802 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1805 /* Invalid URI since the host begins with '[' and ends with ']' but doesn't have
1806 * a valid IP literal inside.
1808 { "ftp://[not.valid.uri]/", 0, E_INVALIDARG, FALSE,
1829 {Uri_HOST_UNKNOWN,S_FALSE,FALSE},
1831 {URL_SCHEME_INVALID,S_FALSE,FALSE},
1832 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1835 /* Valid URI since the '[' and ']' don't appear at the begining and end
1836 * of the host name (respectively).
1838 { "ftp://www.[works].com/", 0, S_OK, FALSE,
1839 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|
1840 Uri_HAS_HOST|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|
1841 Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
1844 {"ftp://www.[works].com/",S_OK,TRUE},
1845 {"www.[works].com",S_OK,TRUE},
1846 {"ftp://www.[works].com/",S_OK,TRUE},
1847 {"[works].com",S_OK,TRUE},
1850 {"www.[works].com",S_OK,TRUE},
1855 {"ftp://www.[works].com/",S_OK,FALSE},
1861 {Uri_HOST_DNS,S_OK,TRUE},
1863 {URL_SCHEME_FTP,S_OK,FALSE},
1864 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1867 /* Considers ':' a delimiter since it appears after the ']'. */
1868 { "http://www.google.com]:12345/", 0, S_OK, FALSE,
1869 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|
1870 Uri_HAS_HOST|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|
1871 Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
1874 {"http://www.google.com]:12345/",S_OK,TRUE},
1875 {"www.google.com]:12345",S_OK,TRUE},
1876 {"http://www.google.com]:12345/",S_OK,TRUE},
1877 {"google.com]",S_OK,TRUE},
1880 {"www.google.com]",S_OK,TRUE},
1885 {"http://www.google.com]:12345/",S_OK,FALSE},
1886 {"http",S_OK,FALSE},
1891 {Uri_HOST_DNS,S_OK,TRUE},
1893 {URL_SCHEME_HTTP,S_OK,FALSE},
1894 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1897 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1898 { "zip://w%XXw%GEw.google.com/", 0, S_OK, FALSE,
1899 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|
1900 Uri_HAS_HOST|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|
1901 Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME,
1904 {"zip://w%XXw%GEw.google.com/",S_OK,TRUE},
1905 {"w%XXw%GEw.google.com",S_OK,TRUE},
1906 {"zip://w%XXw%GEw.google.com/",S_OK,TRUE},
1907 {"google.com",S_OK,TRUE},
1910 {"w%XXw%GEw.google.com",S_OK,TRUE},
1915 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1921 {Uri_HOST_DNS,S_OK,TRUE},
1923 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1924 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1927 /* Not allowed to have invalid % encoded data. */
1928 { "ftp://google.co%XX/", 0, E_INVALIDARG, FALSE,
1949 {Uri_HOST_UNKNOWN,S_FALSE,FALSE},
1951 {URL_SCHEME_INVALID,S_FALSE,FALSE},
1952 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1955 /* Unknown scheme types hostname doesn't get lower cased. */
1956 { "zip://GOOGLE.com/", 0, S_OK, FALSE,
1957 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|
1958 Uri_HAS_HOST|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|
1959 Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME,
1962 {"zip://GOOGLE.com/",S_OK,TRUE},
1963 {"GOOGLE.com",S_OK,TRUE},
1964 {"zip://GOOGLE.com/",S_OK,TRUE},
1965 {"GOOGLE.com",S_OK,TRUE},
1968 {"GOOGLE.com",S_OK,TRUE},
1973 {"zip://GOOGLE.com/",S_OK,FALSE},
1979 {Uri_HOST_DNS,S_OK,TRUE},
1981 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1982 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1985 /* Hostname get's lower cased for known scheme types. */
1986 { "http://WWW.GOOGLE.com/", 0, S_OK, FALSE,
1987 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|
1988 Uri_HAS_HOST|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|
1989 Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
1992 {"http://www.google.com/",S_OK,TRUE},
1993 {"www.google.com",S_OK,TRUE},
1994 {"http://www.google.com/",S_OK,TRUE},
1995 {"google.com",S_OK,TRUE},
1998 {"www.google.com",S_OK,TRUE},
2003 {"http://WWW.GOOGLE.com/",S_OK,FALSE},
2004 {"http",S_OK,FALSE},
2009 {Uri_HOST_DNS,S_OK,TRUE},
2011 {URL_SCHEME_HTTP,S_OK,FALSE},
2012 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2015 /* Characters that get % encoded in the hostname also have their percent
2016 * encoded forms lower cased.
2018 { "http://www.%7Cgoogle|.com/", 0, S_OK, FALSE,
2019 Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|
2020 Uri_HAS_HOST|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|
2021 Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
2024 {"http://www.%7cgoogle%7c.com/",S_OK,TRUE},
2025 {"www.%7cgoogle%7c.com",S_OK,TRUE},
2026 {"http://www.%7cgoogle%7c.com/",S_OK,TRUE},
2027 {"%7cgoogle%7c.com",S_OK,TRUE},
2030 {"www.%7cgoogle%7c.com",S_OK,TRUE},
2035 {"http://www.%7Cgoogle|.com/",S_OK,FALSE},
2036 {"http",S_OK,FALSE},
2041 {Uri_HOST_DNS,S_OK,TRUE},
2043 {URL_SCHEME_HTTP,S_OK,FALSE},
2044 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2049 typedef struct _uri_equality {
2051 DWORD create_flags_a;
2054 DWORD create_flags_b;
2060 static const uri_equality equality_tests[] = {
2062 "HTTP://www.winehq.org/test dir/./",0,FALSE,
2063 "http://www.winehq.org/test dir/../test dir/",0,FALSE,
2067 /* http://www.winehq.org/test%20dir */
2068 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,FALSE,
2069 "http://www.winehq.org/test dir",0,FALSE,
2073 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,FALSE,
2074 "file:///c:/test.mp3",0,FALSE,
2078 "ftp://ftp.winehq.org/",0,FALSE,
2079 "ftp://ftp.winehq.org",0,FALSE,
2083 "ftp://ftp.winehq.org/test/test2/../../testB/",0,FALSE,
2084 "ftp://ftp.winehq.org/t%45stB/",0,FALSE,
2089 static inline LPWSTR a2w(LPCSTR str) {
2093 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
2094 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
2095 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
2101 static inline BOOL heap_free(void* mem) {
2102 return HeapFree(GetProcessHeap(), 0, mem);
2105 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
2106 LPWSTR strAW = a2w(strA);
2107 DWORD ret = lstrcmpW(strAW, strB);
2113 * Simple tests to make sure the CreateUri function handles invalid flag combinations
2116 static void test_CreateUri_InvalidFlags(void) {
2119 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
2121 IUri *uri = (void*) 0xdeadbeef;
2123 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
2125 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
2126 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
2128 todo_wine { ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri); }
2132 static void test_CreateUri_InvalidArgs(void) {
2134 IUri *uri = (void*) 0xdeadbeef;
2136 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
2138 hr = pCreateUri(http_urlW, 0, 0, NULL);
2139 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
2141 hr = pCreateUri(NULL, 0, 0, &uri);
2142 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
2143 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
2145 uri = (void*) 0xdeadbeef;
2146 hr = pCreateUri(invalidW, 0, 0, &uri);
2147 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
2148 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
2151 static void test_IUri_GetPropertyBSTR(void) {
2156 /* Make sure GetPropertyBSTR handles invalid args correctly. */
2157 hr = pCreateUri(http_urlW, 0, 0, &uri);
2158 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
2160 BSTR received = NULL;
2162 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
2163 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
2165 /* Make sure it handles a invalid Uri_PROPERTY's correctly. */
2166 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
2167 ok(hr == S_OK, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
2168 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
2169 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
2170 SysFreeString(received);
2172 /* Make sure it handles the ZONE property correctly. */
2174 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
2175 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
2176 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
2177 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
2178 SysFreeString(received);
2180 if(uri) IUri_Release(uri);
2182 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
2183 uri_properties test = uri_tests[i];
2187 uriW = a2w(test.uri);
2188 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
2189 if(test.create_todo) {
2191 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
2192 hr, test.create_expected, i);
2195 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
2196 hr, test.create_expected, i);
2202 /* Checks all the string properties of the uri. */
2203 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
2204 BSTR received = NULL;
2205 uri_str_property prop = test.str_props[j];
2207 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
2210 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
2211 hr, prop.expected, i, j);
2214 ok(!strcmp_aw(prop.value, received), "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
2215 prop.value, wine_dbgstr_w(received), i, j);
2218 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
2219 hr, prop.expected, i, j);
2220 ok(!strcmp_aw(prop.value, received), "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
2221 prop.value, wine_dbgstr_w(received), i, j);
2224 SysFreeString(received);
2228 if(uri) IUri_Release(uri);
2234 static void test_IUri_GetPropertyDWORD(void) {
2239 hr = pCreateUri(http_urlW, 0, 0, &uri);
2240 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
2242 DWORD received = 0xdeadbeef;
2244 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
2245 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
2247 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
2248 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
2249 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
2251 if(uri) IUri_Release(uri);
2253 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
2254 uri_properties test = uri_tests[i];
2258 uriW = a2w(test.uri);
2259 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
2260 if(test.create_todo) {
2262 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
2263 hr, test.create_expected, i);
2266 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
2267 hr, test.create_expected, i);
2273 /* Checks all the DWORD properties of the uri. */
2274 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
2276 uri_dword_property prop = test.dword_props[j];
2278 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
2281 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
2282 hr, prop.expected, i, j);
2285 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
2286 prop.value, received, i, j);
2289 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
2290 hr, prop.expected, i, j);
2291 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
2292 prop.value, received, i, j);
2297 if(uri) IUri_Release(uri);
2303 /* Tests all the 'Get*' property functions which deal with strings. */
2304 static void test_IUri_GetStrProperties(void) {
2309 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
2310 hr = pCreateUri(http_urlW, 0, 0, &uri);
2311 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
2313 hr = IUri_GetAbsoluteUri(uri, NULL);
2314 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
2316 hr = IUri_GetAuthority(uri, NULL);
2317 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
2319 hr = IUri_GetDisplayUri(uri, NULL);
2320 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
2322 hr = IUri_GetDomain(uri, NULL);
2323 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
2325 hr = IUri_GetExtension(uri, NULL);
2326 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
2328 hr = IUri_GetFragment(uri, NULL);
2329 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
2331 hr = IUri_GetHost(uri, NULL);
2332 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
2334 hr = IUri_GetPassword(uri, NULL);
2335 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
2337 hr = IUri_GetPath(uri, NULL);
2338 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
2340 hr = IUri_GetPathAndQuery(uri, NULL);
2341 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
2343 hr = IUri_GetQuery(uri, NULL);
2344 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
2346 hr = IUri_GetRawUri(uri, NULL);
2347 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
2349 hr = IUri_GetSchemeName(uri, NULL);
2350 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
2352 hr = IUri_GetUserInfo(uri, NULL);
2353 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
2355 hr = IUri_GetUserName(uri, NULL);
2356 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
2358 if(uri) IUri_Release(uri);
2360 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
2361 uri_properties test = uri_tests[i];
2365 uriW = a2w(test.uri);
2366 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
2367 if(test.create_todo) {
2369 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2370 hr, test.create_expected, i);
2373 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2374 hr, test.create_expected, i);
2378 uri_str_property prop;
2379 BSTR received = NULL;
2381 /* GetAbsoluteUri() tests. */
2382 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
2383 hr = IUri_GetAbsoluteUri(uri, &received);
2386 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2387 hr, prop.expected, i);
2390 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2391 prop.value, wine_dbgstr_w(received), i);
2394 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2395 hr, prop.expected, i);
2396 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2397 prop.value, wine_dbgstr_w(received), i);
2399 SysFreeString(received);
2402 /* GetAuthority() tests. */
2403 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
2404 hr = IUri_GetAuthority(uri, &received);
2407 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2408 hr, prop.expected, i);
2411 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2412 prop.value, wine_dbgstr_w(received), i);
2415 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2416 hr, prop.expected, i);
2417 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2418 prop.value, wine_dbgstr_w(received), i);
2420 SysFreeString(received);
2423 /* GetDisplayUri() tests. */
2424 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
2425 hr = IUri_GetDisplayUri(uri, &received);
2428 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2429 hr, prop.expected, i);
2432 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_test[%d].\n",
2433 prop.value, wine_dbgstr_w(received), i);
2436 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2437 hr, prop.expected, i);
2438 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2439 prop.value, wine_dbgstr_w(received), i);
2441 SysFreeString(received);
2444 /* GetDomain() tests. */
2445 prop = test.str_props[Uri_PROPERTY_DOMAIN];
2446 hr = IUri_GetDomain(uri, &received);
2449 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2450 hr, prop.expected, i);
2453 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2454 prop.value, wine_dbgstr_w(received), i);
2457 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2458 hr, prop.expected, i);
2459 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2460 prop.value, wine_dbgstr_w(received), i);
2462 SysFreeString(received);
2465 /* GetExtension() tests. */
2466 prop = test.str_props[Uri_PROPERTY_EXTENSION];
2467 hr = IUri_GetExtension(uri, &received);
2470 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2471 hr, prop.expected, i);
2474 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2475 prop.value, wine_dbgstr_w(received), i);
2478 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2479 hr, prop.expected, i);
2480 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2481 prop.value, wine_dbgstr_w(received), i);
2483 SysFreeString(received);
2486 /* GetFragment() tests. */
2487 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
2488 hr = IUri_GetFragment(uri, &received);
2491 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2492 hr, prop.expected, i);
2495 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2496 prop.value, wine_dbgstr_w(received), i);
2499 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2500 hr, prop.expected, i);
2501 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2502 prop.value, wine_dbgstr_w(received), i);
2504 SysFreeString(received);
2507 /* GetHost() tests. */
2508 prop = test.str_props[Uri_PROPERTY_HOST];
2509 hr = IUri_GetHost(uri, &received);
2512 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2513 hr, prop.expected, i);
2516 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2517 prop.value, wine_dbgstr_w(received), i);
2520 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2521 hr, prop.expected, i);
2522 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2523 prop.value, wine_dbgstr_w(received), i);
2525 SysFreeString(received);
2528 /* GetPassword() tests. */
2529 prop = test.str_props[Uri_PROPERTY_PASSWORD];
2530 hr = IUri_GetPassword(uri, &received);
2533 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2534 hr, prop.expected, i);
2537 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2538 prop.value, wine_dbgstr_w(received), i);
2541 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2542 hr, prop.expected, i);
2543 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2544 prop.value, wine_dbgstr_w(received), i);
2546 SysFreeString(received);
2549 /* GetPath() tests. */
2550 prop = test.str_props[Uri_PROPERTY_PATH];
2551 hr = IUri_GetPath(uri, &received);
2554 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2555 hr, prop.expected, i);
2558 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2559 prop.value, wine_dbgstr_w(received), i);
2562 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2563 hr, prop.expected, i);
2564 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2565 prop.value, wine_dbgstr_w(received), i);
2567 SysFreeString(received);
2570 /* GetPathAndQuery() tests. */
2571 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
2572 hr = IUri_GetPathAndQuery(uri, &received);
2575 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2576 hr, prop.expected, i);
2579 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2580 prop.value, wine_dbgstr_w(received), i);
2583 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2584 hr, prop.expected, i);
2585 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2586 prop.value, wine_dbgstr_w(received), i);
2588 SysFreeString(received);
2591 /* GetQuery() tests. */
2592 prop = test.str_props[Uri_PROPERTY_QUERY];
2593 hr = IUri_GetQuery(uri, &received);
2596 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2597 hr, prop.expected, i);
2600 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2601 prop.value, wine_dbgstr_w(received), i);
2604 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2605 hr, prop.expected, i);
2606 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2607 prop.value, wine_dbgstr_w(received), i);
2609 SysFreeString(received);
2612 /* GetRawUri() tests. */
2613 prop = test.str_props[Uri_PROPERTY_RAW_URI];
2614 hr = IUri_GetRawUri(uri, &received);
2617 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2618 hr, prop.expected, i);
2621 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2622 prop.value, wine_dbgstr_w(received), i);
2625 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2626 hr, prop.expected, i);
2627 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2628 prop.value, wine_dbgstr_w(received), i);
2630 SysFreeString(received);
2633 /* GetSchemeName() tests. */
2634 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
2635 hr = IUri_GetSchemeName(uri, &received);
2638 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2639 hr, prop.expected, i);
2642 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2643 prop.value, wine_dbgstr_w(received), i);
2646 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2647 hr, prop.expected, i);
2648 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2649 prop.value, wine_dbgstr_w(received), i);
2651 SysFreeString(received);
2654 /* GetUserInfo() tests. */
2655 prop = test.str_props[Uri_PROPERTY_USER_INFO];
2656 hr = IUri_GetUserInfo(uri, &received);
2659 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2660 hr, prop.expected, i);
2663 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2664 prop.value, wine_dbgstr_w(received), i);
2667 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2668 hr, prop.expected, i);
2669 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2670 prop.value, wine_dbgstr_w(received), i);
2672 SysFreeString(received);
2675 /* GetUserName() tests. */
2676 prop = test.str_props[Uri_PROPERTY_USER_NAME];
2677 hr = IUri_GetUserName(uri, &received);
2680 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2681 hr, prop.expected, i);
2684 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2685 prop.value, wine_dbgstr_w(received), i);
2688 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2689 hr, prop.expected, i);
2690 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
2691 prop.value, wine_dbgstr_w(received), i);
2693 SysFreeString(received);
2696 if(uri) IUri_Release(uri);
2702 static void test_IUri_GetDwordProperties(void) {
2707 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
2708 hr = pCreateUri(http_urlW, 0, 0, &uri);
2709 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
2711 hr = IUri_GetHostType(uri, NULL);
2712 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
2714 hr = IUri_GetPort(uri, NULL);
2715 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
2717 hr = IUri_GetScheme(uri, NULL);
2718 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
2720 hr = IUri_GetZone(uri, NULL);
2721 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
2723 if(uri) IUri_Release(uri);
2725 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
2726 uri_properties test = uri_tests[i];
2730 uriW = a2w(test.uri);
2731 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
2732 if(test.create_todo) {
2734 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2735 hr, test.create_expected, i);
2738 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2739 hr, test.create_expected, i);
2743 uri_dword_property prop;
2746 /* Assign an insane value so tests don't accidentally pass when
2749 received = -9999999;
2751 /* GetHostType() tests. */
2752 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
2753 hr = IUri_GetHostType(uri, &received);
2756 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2757 hr, prop.expected, i);
2760 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
2763 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2764 hr, prop.expected, i);
2765 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
2767 received = -9999999;
2769 /* GetPort() tests. */
2770 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
2771 hr = IUri_GetPort(uri, &received);
2774 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2775 hr, prop.expected, i);
2778 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
2781 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2782 hr, prop.expected, i);
2783 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
2785 received = -9999999;
2787 /* GetScheme() tests. */
2788 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
2789 hr = IUri_GetScheme(uri, &received);
2792 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2793 hr, prop.expected, i);
2796 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
2799 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2800 hr, prop.expected, i);
2801 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
2803 received = -9999999;
2805 /* GetZone() tests. */
2806 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
2807 hr = IUri_GetZone(uri, &received);
2810 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2811 hr, prop.expected, i);
2814 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
2817 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2818 hr, prop.expected, i);
2819 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
2823 if(uri) IUri_Release(uri);
2829 static void test_IUri_GetPropertyLength(void) {
2834 /* Make sure it handles invalid args correctly. */
2835 hr = pCreateUri(http_urlW, 0, 0, &uri);
2836 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
2838 DWORD received = 0xdeadbeef;
2840 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
2841 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
2843 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
2844 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
2845 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
2847 if(uri) IUri_Release(uri);
2849 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
2850 uri_properties test = uri_tests[i];
2854 uriW = a2w(test.uri);
2855 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
2856 if(test.create_todo) {
2858 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
2859 hr, test.create_expected, i);
2862 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
2863 hr, test.create_expected, i);
2869 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
2870 DWORD expectedLen, receivedLen;
2871 uri_str_property prop = test.str_props[j];
2873 expectedLen = lstrlen(prop.value);
2875 /* This won't be necessary once GetPropertyLength is implemented. */
2878 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
2881 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
2882 hr, prop.expected, i, j);
2885 ok(receivedLen == expectedLen, "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
2886 expectedLen, receivedLen, i, j);
2889 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
2890 hr, prop.expected, i, j);
2891 ok(receivedLen == expectedLen, "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
2892 expectedLen, receivedLen, i, j);
2897 if(uri) IUri_Release(uri);
2903 static void test_IUri_GetProperties(void) {
2908 hr = pCreateUri(http_urlW, 0, 0, &uri);
2909 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
2911 hr = IUri_GetProperties(uri, NULL);
2912 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
2914 if(uri) IUri_Release(uri);
2916 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
2917 uri_properties test = uri_tests[i];
2921 uriW = a2w(test.uri);
2922 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
2923 if(test.create_todo) {
2925 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
2928 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
2935 hr = IUri_GetProperties(uri, &received);
2936 if(test.props_todo) {
2938 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
2941 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
2944 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
2945 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
2946 if(test.props & (1 << j)) {
2947 if(test.props_todo) {
2949 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
2952 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
2955 /* NOTE: Since received is initialized to 0, this test will always pass while
2956 * GetProperties is unimplemented.
2958 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
2963 if(uri) IUri_Release(uri);
2969 static void test_IUri_HasProperty(void) {
2974 hr = pCreateUri(http_urlW, 0, 0, &uri);
2975 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
2977 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
2978 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
2980 if(uri) IUri_Release(uri);
2982 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
2983 uri_properties test = uri_tests[i];
2987 uriW = a2w(test.uri);
2989 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
2990 if(test.create_todo) {
2992 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
2995 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
3001 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
3002 /* Assign -1, then explicitly test for TRUE or FALSE later. */
3005 hr = IUri_HasProperty(uri, j, &received);
3006 if(test.props_todo) {
3008 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
3012 /* Check if the property should be true. */
3013 if(test.props & (1 << j)) {
3015 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
3019 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
3023 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
3026 if(test.props & (1 << j)) {
3027 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
3029 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
3035 if(uri) IUri_Release(uri);
3041 static void test_IUri_IsEqual(void) {
3048 /* Make sure IsEqual handles invalid args correctly. */
3049 hrA = pCreateUri(http_urlW, 0, 0, &uriA);
3050 hrB = pCreateUri(http_urlW, 0, 0, &uriB);
3051 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hrA, S_OK);
3052 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hrB, S_OK);
3053 if(SUCCEEDED(hrA) && SUCCEEDED(hrB)) {
3055 hrA = IUri_IsEqual(uriA, NULL, &equal);
3056 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hrA, S_OK);
3057 ok(equal == FALSE, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
3059 hrA = IUri_IsEqual(uriA, uriB, NULL);
3060 ok(hrA == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hrA, E_POINTER);
3062 if(uriA) IUri_Release(uriA);
3063 if(uriB) IUri_Release(uriB);
3065 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
3066 uri_equality test = equality_tests[i];
3067 LPWSTR uriA_W, uriB_W;
3071 uriA_W = a2w(test.a);
3072 uriB_W = a2w(test.b);
3074 hrA = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
3075 if(test.create_todo_a) {
3077 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n",
3081 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n",
3085 hrB = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
3086 if(test.create_todo_b) {
3088 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n",
3092 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n",
3096 if(SUCCEEDED(hrA) && SUCCEEDED(hrB)) {
3099 hrA = IUri_IsEqual(uriA, uriB, &equal);
3102 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n",
3106 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
3109 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hrA, S_OK, i);
3110 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
3113 if(uriA) IUri_Release(uriA);
3114 if(uriB) IUri_Release(uriB);
3124 hurlmon = GetModuleHandle("urlmon.dll");
3125 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
3128 win_skip("CreateUri is not present, skipping tests.\n");
3132 trace("test CreateUri invalid flags...\n");
3133 test_CreateUri_InvalidFlags();
3135 trace("test CreateUri invalid args...\n");
3136 test_CreateUri_InvalidArgs();
3138 trace("test IUri_GetPropertyBSTR...\n");
3139 test_IUri_GetPropertyBSTR();
3141 trace("test IUri_GetPropertyDWORD...\n");
3142 test_IUri_GetPropertyDWORD();
3144 trace("test IUri_GetStrProperties...\n");
3145 test_IUri_GetStrProperties();
3147 trace("test IUri_GetDwordProperties...\n");
3148 test_IUri_GetDwordProperties();
3150 trace("test IUri_GetPropertyLength...\n");
3151 test_IUri_GetPropertyLength();
3153 trace("test IUri_GetProperties...\n");
3154 test_IUri_GetProperties();
3156 trace("test IUri_HasProperty...\n");
3157 test_IUri_HasProperty();
3159 trace("test IUri_IsEqual...\n");
3160 test_IUri_IsEqual();