urlmon: Implemented IUri_GetDomain.

This commit is contained in:
Thomas Mullaly 2010-07-16 11:46:35 -04:00 committed by Alexandre Julliard
parent 41513ef243
commit aef9b15ca1
2 changed files with 121 additions and 102 deletions

View File

@ -97,7 +97,7 @@ static const uri_properties uri_tests[] = {
{"http://www.winehq.org/",S_OK,TRUE}, /* ABSOLUTE_URI */
{"www.winehq.org",S_OK,FALSE}, /* AUTHORITY */
{"http://www.winehq.org/",S_OK,TRUE}, /* DISPLAY_URI */
{"winehq.org",S_OK,TRUE}, /* DOMAIN */
{"winehq.org",S_OK,FALSE}, /* DOMAIN */
{"",S_FALSE,TRUE}, /* EXTENSION */
{"",S_FALSE,TRUE}, /* FRAGMENT */
{"www.winehq.org",S_OK,FALSE}, /* HOST */
@ -126,7 +126,7 @@ static const uri_properties uri_tests[] = {
{"http://winehq.org/tests",S_OK,TRUE},
{"winehq.org",S_OK,FALSE},
{"http://winehq.org/tests",S_OK,TRUE},
{"winehq.org",S_OK,TRUE},
{"winehq.org",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"winehq.org",S_OK,FALSE},
@ -155,7 +155,7 @@ static const uri_properties uri_tests[] = {
{"http://www.winehq.org/?query=x&return=y",S_OK,TRUE},
{"www.winehq.org",S_OK,FALSE},
{"http://www.winehq.org/?query=x&return=y",S_OK,TRUE},
{"winehq.org",S_OK,TRUE},
{"winehq.org",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"www.winehq.org",S_OK,FALSE},
@ -184,7 +184,7 @@ static const uri_properties uri_tests[] = {
{"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,TRUE},
{"usEr%3Ainfo@example.com",S_OK,FALSE},
{"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,TRUE},
{"example.com",S_OK,TRUE},
{"example.com",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"example.com",S_OK,FALSE},
@ -214,7 +214,7 @@ static const uri_properties uri_tests[] = {
{"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,TRUE},
{"winepass:wine@ftp.winehq.org:9999",S_OK,FALSE},
{"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,TRUE},
{"winehq.org",S_OK,TRUE},
{"winehq.org",S_OK,FALSE},
{".txt",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"ftp.winehq.org",S_OK,FALSE},
@ -242,7 +242,7 @@ static const uri_properties uri_tests[] = {
{"file:///c:/tests/foo%2520bar.mp3",S_OK,TRUE},
{"",S_FALSE,FALSE},
{"file:///c:/tests/foo%2520bar.mp3",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{".mp3",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
@ -270,7 +270,7 @@ static const uri_properties uri_tests[] = {
{"file:///tests/test%20file.README.txt",S_OK,TRUE},
{"",S_FALSE,FALSE},
{"file:///tests/test%20file.README.txt",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{".txt",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
@ -298,7 +298,7 @@ static const uri_properties uri_tests[] = {
{"urn:nothing:should:happen here",S_OK,TRUE},
{"",S_FALSE,FALSE},
{"urn:nothing:should:happen here",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
@ -327,7 +327,7 @@ static const uri_properties uri_tests[] = {
{"http://127.0.0.1/test%20dir/test.txt",S_OK,TRUE},
{"127.0.0.1",S_OK,FALSE},
{"http://127.0.0.1/test%20dir/test.txt",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{".txt",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"127.0.0.1",S_OK,FALSE},
@ -356,7 +356,7 @@ static const uri_properties uri_tests[] = {
{"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,TRUE},
{"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,FALSE},
{"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,FALSE},
@ -385,7 +385,7 @@ static const uri_properties uri_tests[] = {
{"ftp://[::13.1.68.3]/",S_OK,TRUE},
{"[::13.1.68.3]",S_OK,FALSE},
{"ftp://[::13.1.68.3]/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"::13.1.68.3",S_OK,FALSE},
@ -414,7 +414,7 @@ static const uri_properties uri_tests[] = {
{"http://[fedc:ba98::3210]/",S_OK,TRUE},
{"[fedc:ba98::3210]",S_OK,FALSE},
{"http://[fedc:ba98::3210]/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"fedc:ba98::3210",S_OK,FALSE},
@ -443,7 +443,7 @@ static const uri_properties uri_tests[] = {
{"1234://www.winehq.org/",S_OK,TRUE},
{"www.winehq.org",S_OK,FALSE},
{"1234://www.winehq.org/",S_OK,TRUE},
{"winehq.org",S_OK,TRUE},
{"winehq.org",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"www.winehq.org",S_OK,FALSE},
@ -472,7 +472,7 @@ static const uri_properties uri_tests[] = {
{"file:///C:/test/test.mp3",S_OK,TRUE},
{"",S_FALSE,FALSE},
{"file:///C:/test/test.mp3",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{".mp3",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
@ -502,7 +502,7 @@ static const uri_properties uri_tests[] = {
{"file://server/test.mp3",S_OK,TRUE},
{"server",S_OK,FALSE},
{"file://server/test.mp3",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{".mp3",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"server",S_OK,FALSE},
@ -531,7 +531,7 @@ static const uri_properties uri_tests[] = {
{"*:www.winehq.org/test",S_OK,TRUE},
{"www.winehq.org",S_OK,FALSE},
{"*:www.winehq.org/test",S_OK,TRUE},
{"winehq.org",S_OK,TRUE},
{"winehq.org",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"www.winehq.org",S_OK,FALSE},
@ -561,7 +561,7 @@ static const uri_properties uri_tests[] = {
{"*:www.winehq.org/test",S_OK,TRUE},
{"www.winehq.org",S_OK,FALSE},
{"*:www.winehq.org/test",S_OK,TRUE},
{"winehq.org",S_OK,TRUE},
{"winehq.org",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"www.winehq.org",S_OK,FALSE},
@ -589,7 +589,7 @@ static const uri_properties uri_tests[] = {
{"/../some dir/test.ext",S_OK,TRUE},
{"",S_FALSE,FALSE},
{"/../some dir/test.ext",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{".ext",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
@ -617,7 +617,7 @@ static const uri_properties uri_tests[] = {
{"*://implicit/wildcard/uri%20scheme",S_OK,TRUE},
{"",S_OK,FALSE},
{"*://implicit/wildcard/uri%20scheme",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"",S_OK,FALSE},
@ -647,7 +647,7 @@ static const uri_properties uri_tests[] = {
{"zip:/.//google.com",S_OK,TRUE},
{"",S_FALSE,FALSE},
{"zip:/.//google.com",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{".com",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
@ -678,7 +678,7 @@ static const uri_properties uri_tests[] = {
{"ftp://user:pass:word@winehq.org/",S_OK,TRUE},
{"user:pass:word@winehq.org",S_OK,FALSE},
{"ftp://winehq.org/",S_OK,TRUE},
{"winehq.org",S_OK,TRUE},
{"winehq.org",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"winehq.org",S_OK,FALSE},
@ -709,7 +709,7 @@ static const uri_properties uri_tests[] = {
{"ftp://wINe:PASS@ftp.google.com/",S_OK,TRUE},
{"wINe:PASS@ftp.google.com",S_OK,FALSE},
{"ftp://ftp.google.com/",S_OK,TRUE},
{"google.com",S_OK,TRUE},
{"google.com",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"ftp.google.com",S_OK,FALSE},
@ -740,7 +740,7 @@ static const uri_properties uri_tests[] = {
{"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,TRUE},
{"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK,FALSE},
{"ftp://ftp.google.com/",S_OK,TRUE},
{"google.com",S_OK,TRUE},
{"google.com",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"ftp.google.com",S_OK,FALSE},
@ -771,7 +771,7 @@ static const uri_properties uri_tests[] = {
{"ftp://empty:@ftp.google.com/",S_OK,TRUE},
{"empty:@ftp.google.com",S_OK,FALSE},
{"ftp://ftp.google.com/",S_OK,TRUE},
{"google.com",S_OK,TRUE},
{"google.com",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"ftp.google.com",S_OK,FALSE},
@ -802,7 +802,7 @@ static const uri_properties uri_tests[] = {
{"ftp://%22%20%22weird@ftp.google.com/",S_OK,TRUE},
{"%22%20%22weird@ftp.google.com",S_OK,FALSE},
{"ftp://ftp.google.com/",S_OK,TRUE},
{"google.com",S_OK,TRUE},
{"google.com",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"ftp.google.com",S_OK,FALSE},
@ -833,7 +833,7 @@ static const uri_properties uri_tests[] = {
{"ftp://\" \"weird@ftp.google.com/",S_OK,TRUE},
{"\" \"weird@ftp.google.com",S_OK,FALSE},
{"ftp://ftp.google.com/",S_OK,TRUE},
{"google.com",S_OK,TRUE},
{"google.com",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"ftp.google.com",S_OK,FALSE},
@ -863,7 +863,7 @@ static const uri_properties uri_tests[] = {
{"zip://%xy:word@winehq.org/",S_OK,TRUE},
{"%xy:word@winehq.org",S_OK,FALSE},
{"zip://%xy:word@winehq.org/",S_OK,TRUE},
{"winehq.org",S_OK,TRUE},
{"winehq.org",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"winehq.org",S_OK,FALSE},
@ -895,7 +895,7 @@ static const uri_properties uri_tests[] = {
{"zip://%2E:%52%53ord@winehq.org/",S_OK,TRUE},
{"%2E:%52%53ord@winehq.org",S_OK,FALSE},
{"zip://%2E:%52%53ord@winehq.org/",S_OK,TRUE},
{"winehq.org",S_OK,TRUE},
{"winehq.org",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"winehq.org",S_OK,FALSE},
@ -925,7 +925,7 @@ static const uri_properties uri_tests[] = {
{"ftp://[](),'test':word@winehq.org/",S_OK,TRUE},
{"[](),'test':word@winehq.org",S_OK,FALSE},
{"ftp://winehq.org/",S_OK,TRUE},
{"winehq.org",S_OK,TRUE},
{"winehq.org",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"winehq.org",S_OK,FALSE},
@ -954,7 +954,7 @@ static const uri_properties uri_tests[] = {
{"ftp://test/?:word@winehq.org/",S_OK,TRUE},
{"test",S_OK,FALSE},
{"ftp://test/?:word@winehq.org/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"test",S_OK,FALSE},
@ -983,7 +983,7 @@ static const uri_properties uri_tests[] = {
{"ftp://test/#:word@winehq.org/",S_OK,TRUE},
{"test",S_OK,FALSE},
{"ftp://test/#:word@winehq.org/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"#:word@winehq.org/",S_OK,TRUE},
{"test",S_OK,FALSE},
@ -1013,7 +1013,7 @@ static const uri_properties uri_tests[] = {
{"zip://test\\:word@winehq.org/",S_OK,TRUE},
{"test\\:word@winehq.org",S_OK,FALSE},
{"zip://test\\:word@winehq.org/",S_OK,TRUE},
{"winehq.org",S_OK,TRUE},
{"winehq.org",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"winehq.org",S_OK,FALSE},
@ -1043,7 +1043,7 @@ static const uri_properties uri_tests[] = {
{"http://127.0.0.100/",S_OK,TRUE},
{"127.0.0.100",S_OK,FALSE},
{"http://127.0.0.100/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"127.0.0.100",S_OK,FALSE},
@ -1073,7 +1073,7 @@ static const uri_properties uri_tests[] = {
{"http://127.0.0.0/",S_OK,TRUE},
{"127.0.0.0",S_OK,FALSE},
{"http://127.0.0.0/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"127.0.0.0",S_OK,FALSE},
@ -1103,7 +1103,7 @@ static const uri_properties uri_tests[] = {
{"http://0.1.226.64/",S_OK,TRUE},
{"0.1.226.64",S_OK,FALSE},
{"http://0.1.226.64/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"0.1.226.64",S_OK,FALSE},
@ -1133,7 +1133,7 @@ static const uri_properties uri_tests[] = {
{"http://255.255.255.255/",S_OK,TRUE},
{"255.255.255.255",S_OK,FALSE},
{"http://255.255.255.255/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"255.255.255.255",S_OK,FALSE},
@ -1163,7 +1163,7 @@ static const uri_properties uri_tests[] = {
{"http://4294967296/",S_OK,TRUE},
{"4294967296",S_OK,FALSE},
{"http://4294967296/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"4294967296",S_OK,FALSE},
@ -1193,7 +1193,7 @@ static const uri_properties uri_tests[] = {
{"1234://4294967295/",S_OK,TRUE},
{"4294967295",S_OK,FALSE},
{"1234://4294967295/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"4294967295",S_OK,FALSE},
@ -1223,7 +1223,7 @@ static const uri_properties uri_tests[] = {
{"1234://127.001/",S_OK,TRUE},
{"127.001",S_OK,FALSE},
{"1234://127.001/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"127.001",S_OK,FALSE},
@ -1252,7 +1252,7 @@ static const uri_properties uri_tests[] = {
{"http://[fedc:ba98::3210]/",S_OK,TRUE},
{"[fedc:ba98::3210]",S_OK,FALSE},
{"http://[fedc:ba98::3210]/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"fedc:ba98::3210",S_OK,FALSE},
@ -1281,7 +1281,7 @@ static const uri_properties uri_tests[] = {
{"http://[::]/",S_OK,TRUE},
{"[::]",S_OK,FALSE},
{"http://[::]/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"::",S_OK,FALSE},
@ -1310,7 +1310,7 @@ static const uri_properties uri_tests[] = {
{"http://[fedc:ba98::]/",S_OK,TRUE},
{"[fedc:ba98::]",S_OK,FALSE},
{"http://[fedc:ba98::]/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"fedc:ba98::",S_OK,FALSE},
@ -1340,7 +1340,7 @@ static const uri_properties uri_tests[] = {
{"http://[1:0:3:4:5:6:7:8]/",S_OK,TRUE},
{"[1:0:3:4:5:6:7:8]",S_OK,FALSE},
{"http://[1:0:3:4:5:6:7:8]/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"1:0:3:4:5:6:7:8",S_OK,FALSE},
@ -1369,7 +1369,7 @@ static const uri_properties uri_tests[] = {
{"http://[v2.34]/",S_OK,TRUE},
{"[v2.34]",S_OK,FALSE},
{"http://[v2.34]/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"[v2.34]",S_OK,FALSE},
@ -1399,7 +1399,7 @@ static const uri_properties uri_tests[] = {
{"http://[xyz:12345.com/test",S_OK,TRUE},
{"[xyz:12345.com",S_OK,FALSE},
{"http://[xyz:12345.com/test",S_OK,TRUE},
{"[xyz:12345.com",S_OK,TRUE},
{"[xyz:12345.com",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"[xyz:12345.com",S_OK,FALSE},
@ -1431,7 +1431,7 @@ static const uri_properties uri_tests[] = {
{"ftp://www.[works].com/",S_OK,TRUE},
{"www.[works].com",S_OK,FALSE},
{"ftp://www.[works].com/",S_OK,TRUE},
{"[works].com",S_OK,TRUE},
{"[works].com",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"www.[works].com",S_OK,FALSE},
@ -1461,7 +1461,7 @@ static const uri_properties uri_tests[] = {
{"http://www.google.com]:12345/",S_OK,TRUE},
{"www.google.com]:12345",S_OK,FALSE},
{"http://www.google.com]:12345/",S_OK,TRUE},
{"google.com]",S_OK,TRUE},
{"google.com]",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"www.google.com]",S_OK,FALSE},
@ -1491,7 +1491,7 @@ static const uri_properties uri_tests[] = {
{"zip://w%XXw%GEw.google.com/",S_OK,TRUE},
{"w%XXw%GEw.google.com",S_OK,FALSE},
{"zip://w%XXw%GEw.google.com/",S_OK,TRUE},
{"google.com",S_OK,TRUE},
{"google.com",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"w%XXw%GEw.google.com",S_OK,FALSE},
@ -1521,7 +1521,7 @@ static const uri_properties uri_tests[] = {
{"zip://GOOGLE.com/",S_OK,TRUE},
{"GOOGLE.com",S_OK,FALSE},
{"zip://GOOGLE.com/",S_OK,TRUE},
{"GOOGLE.com",S_OK,TRUE},
{"GOOGLE.com",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"GOOGLE.com",S_OK,FALSE},
@ -1551,7 +1551,7 @@ static const uri_properties uri_tests[] = {
{"http://www.google.com/",S_OK,TRUE},
{"www.google.com",S_OK,FALSE},
{"http://www.google.com/",S_OK,TRUE},
{"google.com",S_OK,TRUE},
{"google.com",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"www.google.com",S_OK,FALSE},
@ -1583,7 +1583,7 @@ static const uri_properties uri_tests[] = {
{"http://www.%7cgoogle%7c.com/",S_OK,TRUE},
{"www.%7cgoogle%7c.com",S_OK,FALSE},
{"http://www.%7cgoogle%7c.com/",S_OK,TRUE},
{"%7cgoogle%7c.com",S_OK,TRUE},
{"%7cgoogle%7c.com",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"www.%7cgoogle%7c.com",S_OK,FALSE},
@ -1613,7 +1613,7 @@ static const uri_properties uri_tests[] = {
{"http://[1:2:3:4:5:6::]/",S_OK,TRUE},
{"[1:2:3:4:5:6::]",S_OK,FALSE},
{"http://[1:2:3:4:5:6::]/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"1:2:3:4:5:6::",S_OK,FALSE},
@ -1643,7 +1643,7 @@ static const uri_properties uri_tests[] = {
{"http://[::1.2.3.0]/",S_OK,TRUE},
{"[::1.2.3.0]",S_OK,FALSE},
{"http://[::1.2.3.0]/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"::1.2.3.0",S_OK,FALSE},
@ -1673,7 +1673,7 @@ static const uri_properties uri_tests[] = {
{"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,TRUE},
{"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
{"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE},
@ -1703,7 +1703,7 @@ static const uri_properties uri_tests[] = {
{"http://[ffff::c0de:6f20]/",S_OK,TRUE},
{"[ffff::c0de:6f20]",S_OK,FALSE},
{"http://[ffff::c0de:6f20]/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"ffff::c0de:6f20",S_OK,FALSE},
@ -1733,7 +1733,7 @@ static const uri_properties uri_tests[] = {
{"http://google.com:65535/",S_OK,TRUE},
{"google.com:65535",S_OK,FALSE},
{"http://google.com:65535/",S_OK,TRUE},
{"google.com",S_OK,TRUE},
{"google.com",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"google.com",S_OK,FALSE},
@ -1762,7 +1762,7 @@ static const uri_properties uri_tests[] = {
{"zip://google.com:65536/",S_OK,TRUE},
{"google.com:65536",S_OK,FALSE},
{"zip://google.com:65536/",S_OK,TRUE},
{"google.com:65536",S_OK,TRUE},
{"google.com:65536",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"google.com:65536",S_OK,FALSE},
@ -1791,7 +1791,7 @@ static const uri_properties uri_tests[] = {
{"zip://google.com:65536:25/",S_OK,TRUE},
{"google.com:65536:25",S_OK,FALSE},
{"zip://google.com:65536:25/",S_OK,TRUE},
{"google.com:65536:25",S_OK,TRUE},
{"google.com:65536:25",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"google.com:65536:25",S_OK,FALSE},
@ -1820,7 +1820,7 @@ static const uri_properties uri_tests[] = {
{"zip://[::ffff]:abcd/",S_OK,TRUE},
{"[::ffff]:abcd",S_OK,FALSE},
{"zip://[::ffff]:abcd/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"[::ffff]:abcd",S_OK,FALSE},
@ -1849,7 +1849,7 @@ static const uri_properties uri_tests[] = {
{"zip://127.0.0.1:abcd/",S_OK,TRUE},
{"127.0.0.1:abcd",S_OK,FALSE},
{"zip://127.0.0.1:abcd/",S_OK,TRUE},
{"0.1:abcd",S_OK,TRUE},
{"0.1:abcd",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"127.0.0.1:abcd",S_OK,FALSE},
@ -1878,7 +1878,7 @@ static const uri_properties uri_tests[] = {
{"http://google.com:00035",S_OK,TRUE},
{"google.com:00035",S_OK,FALSE},
{"http://google.com:00035",S_OK,TRUE,"http://google.com:35"},
{"google.com",S_OK,TRUE},
{"google.com",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"google.com",S_OK,FALSE},
@ -1907,7 +1907,7 @@ static const uri_properties uri_tests[] = {
{"http://google.com:80",S_OK,TRUE},
{"google.com:80",S_OK,FALSE},
{"http://google.com:80",S_OK,TRUE},
{"google.com",S_OK,TRUE},
{"google.com",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"google.com",S_OK,FALSE},
@ -1936,7 +1936,7 @@ static const uri_properties uri_tests[] = {
{"http://google.com.uk/",S_OK,TRUE},
{"google.com.uk",S_OK,FALSE},
{"http://google.com.uk/",S_OK,TRUE},
{"google.com.uk",S_OK,TRUE},
{"google.com.uk",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"google.com.uk",S_OK,FALSE},
@ -1965,7 +1965,7 @@ static const uri_properties uri_tests[] = {
{"http://google.com.com/",S_OK,TRUE},
{"google.com.com",S_OK,FALSE},
{"http://google.com.com/",S_OK,TRUE},
{"com.com",S_OK,TRUE},
{"com.com",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"google.com.com",S_OK,FALSE},
@ -1994,7 +1994,7 @@ static const uri_properties uri_tests[] = {
{"http://google.uk.1/",S_OK,TRUE},
{"google.uk.1",S_OK,FALSE},
{"http://google.uk.1/",S_OK,TRUE},
{"google.uk.1",S_OK,TRUE},
{"google.uk.1",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"google.uk.1",S_OK,FALSE},
@ -2024,7 +2024,7 @@ static const uri_properties uri_tests[] = {
{"http://google.foo.uk/",S_OK,TRUE},
{"google.foo.uk",S_OK,FALSE},
{"http://google.foo.uk/",S_OK,TRUE},
{"foo.uk",S_OK,TRUE},
{"foo.uk",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"google.foo.uk",S_OK,FALSE},
@ -2053,7 +2053,7 @@ static const uri_properties uri_tests[] = {
{"http://.com/",S_OK,TRUE},
{".com",S_OK,FALSE},
{"http://.com/",S_OK,TRUE},
{".com",S_OK,TRUE},
{".com",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{".com",S_OK,FALSE},
@ -2082,7 +2082,7 @@ static const uri_properties uri_tests[] = {
{"http://.uk/",S_OK,TRUE},
{".uk",S_OK,FALSE},
{"http://.uk/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{".uk",S_OK,FALSE},
@ -2111,7 +2111,7 @@ static const uri_properties uri_tests[] = {
{"http://www.co.google.com.[]/",S_OK,TRUE},
{"www.co.google.com.[]",S_OK,FALSE},
{"http://www.co.google.com.[]/",S_OK,TRUE},
{"google.com.[]",S_OK,TRUE},
{"google.com.[]",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"www.co.google.com.[]",S_OK,FALSE},
@ -2140,7 +2140,7 @@ static const uri_properties uri_tests[] = {
{"http://co.uk/",S_OK,TRUE},
{"co.uk",S_OK,FALSE},
{"http://co.uk/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"co.uk",S_OK,FALSE},
@ -2169,7 +2169,7 @@ static const uri_properties uri_tests[] = {
{"http://www.co.google.us.test/",S_OK,TRUE},
{"www.co.google.us.test",S_OK,FALSE},
{"http://www.co.google.us.test/",S_OK,TRUE},
{"us.test",S_OK,TRUE},
{"us.test",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"www.co.google.us.test",S_OK,FALSE},
@ -2198,7 +2198,7 @@ static const uri_properties uri_tests[] = {
{"http://gov.uk/",S_OK,TRUE},
{"gov.uk",S_OK,FALSE},
{"http://gov.uk/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"gov.uk",S_OK,FALSE},
@ -2678,27 +2678,6 @@ static void test_IUri_GetStrProperties(void) {
SysFreeString(received);
received = NULL;
/* GetDomain() tests. */
prop = test.str_props[Uri_PROPERTY_DOMAIN];
hr = IUri_GetDomain(uri, &received);
if(prop.todo) {
todo_wine {
ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
hr, prop.expected, i);
}
todo_wine {
ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
prop.value, wine_dbgstr_w(received), i);
}
} else {
ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
hr, prop.expected, i);
ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
prop.value, wine_dbgstr_w(received), i);
}
SysFreeString(received);
received = NULL;
/* GetExtension() tests. */
prop = test.str_props[Uri_PROPERTY_EXTENSION];
hr = IUri_GetExtension(uri, &received);
@ -2784,6 +2763,27 @@ static void test_IUri_GetStrProperties(void) {
SysFreeString(received);
received = NULL;
/* GetDomain() tests. */
prop = test.str_props[Uri_PROPERTY_DOMAIN];
hr = IUri_GetDomain(uri, &received);
if(prop.todo) {
todo_wine {
ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
hr, prop.expected, i);
}
todo_wine {
ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
prop.value, wine_dbgstr_w(received), i);
}
} else {
ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
hr, prop.expected, i);
ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
prop.value, wine_dbgstr_w(received), i);
}
SysFreeString(received);
received = NULL;
/* GetHost() tests. */
prop = test.str_props[Uri_PROPERTY_HOST];
hr = IUri_GetHost(uri, &received);

View File

@ -351,8 +351,8 @@ static const WCHAR *str_last_of(const WCHAR *str, const WCHAR *end, WCHAR ch) {
* a valid domain name it will assign 'domain_start' the offset
* into 'host' where the domain name starts.
*
* It's implied that if a domain name is found that it goes
* from [host+domain_start, host+host_len).
* It's implied that if a domain name its range is implied to be
* [host+domain_start, host+host_len).
*/
static void find_domain_name(const WCHAR *host, DWORD host_len,
INT *domain_start) {
@ -2023,6 +2023,7 @@ static BOOL canonicalize_ipv6address(const parse_data *data, Uri *uri,
static BOOL canonicalize_host(const parse_data *data, Uri *uri, DWORD flags, BOOL computeOnly) {
uri->host_start = -1;
uri->host_len = 0;
uri->domain_offset = -1;
if(data->host) {
switch(data->host_type) {
@ -2189,6 +2190,7 @@ static BOOL canonicalize_hierpart(const parse_data *data, Uri *uri, DWORD flags,
uri->has_port = FALSE;
uri->authority_start = -1;
uri->authority_len = 0;
uri->domain_offset = -1;
}
return TRUE;
@ -2397,6 +2399,20 @@ static HRESULT WINAPI Uri_GetPropertyBSTR(IUri *iface, Uri_PROPERTY uriProp, BST
hres = S_FALSE;
}
if(!(*pbstrProperty))
hres = E_OUTOFMEMORY;
break;
case Uri_PROPERTY_DOMAIN:
if(This->domain_offset > -1) {
*pbstrProperty = SysAllocStringLen(This->canon_uri+This->host_start+This->domain_offset,
This->host_len-This->domain_offset);
hres = S_OK;
} else {
*pbstrProperty = SysAllocStringLen(NULL, 0);
hres = S_FALSE;
}
if(!(*pbstrProperty))
hres = E_OUTOFMEMORY;
@ -2520,6 +2536,14 @@ static HRESULT WINAPI Uri_GetPropertyLength(IUri *iface, Uri_PROPERTY uriProp, D
*pcchProperty = This->authority_len;
hres = (This->authority_start > -1) ? S_OK : S_FALSE;
break;
case Uri_PROPERTY_DOMAIN:
if(This->domain_offset > -1)
*pcchProperty = This->host_len - This->domain_offset;
else
*pcchProperty = 0;
hres = (This->domain_offset > -1) ? S_OK : S_FALSE;
break;
case Uri_PROPERTY_HOST:
*pcchProperty = This->host_len;
@ -2650,13 +2674,8 @@ static HRESULT WINAPI Uri_GetDisplayUri(IUri *iface, BSTR *pstrDisplayUri)
static HRESULT WINAPI Uri_GetDomain(IUri *iface, BSTR *pstrDomain)
{
Uri *This = URI_THIS(iface);
FIXME("(%p)->(%p)\n", This, pstrDomain);
if(!pstrDomain)
return E_POINTER;
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", iface, pstrDomain);
return Uri_GetPropertyBSTR(iface, Uri_PROPERTY_DOMAIN, pstrDomain, 0);
}
static HRESULT WINAPI Uri_GetExtension(IUri *iface, BSTR *pstrExtension)