shlwapi: GetUrlPart can get the scheme of url's without a ://.

This commit is contained in:
Vincent Povirk 2010-02-15 15:09:55 -06:00 committed by Alexandre Julliard
parent f45b648634
commit 90b7ccc36a
2 changed files with 9 additions and 1 deletions

View File

@ -570,6 +570,7 @@ static void test_UrlGetPart(void)
{
const char* file_url = "file://h o s t/c:/windows/file";
const char* http_url = "http://user:pass 123@www.wine hq.org";
const char* about_url = "about:blank";
CHAR szPart[INTERNET_MAX_URL_LENGTH];
DWORD dwSize;
@ -607,6 +608,12 @@ static void test_UrlGetPart(void)
test_url_part(http_url, URL_PART_HOSTNAME, 0, "www.wine hq.org");
test_url_part(http_url, URL_PART_PASSWORD, 0, "pass 123");
test_url_part(about_url, URL_PART_SCHEME, 0, "about");
dwSize = sizeof(szPart);
res = pUrlGetPartA(about_url, szPart, &dwSize, URL_PART_HOSTNAME, 0);
ok(res==E_FAIL, "returned %08x\n", res);
dwSize = sizeof(szPart);
res = pUrlGetPartA("file://c:\\index.htm", szPart, &dwSize, URL_PART_HOSTNAME, 0);
ok(res==S_FALSE, "returned %08x\n", res);

View File

@ -1938,7 +1938,7 @@ static LONG URL_ParseUrl(LPCWSTR pszUrl, WINE_PARSE_URL *pl)
work = URL_ScanID(pl->pScheme, &pl->szScheme, SCHEME);
if (!*work || (*work != ':')) goto ErrorExit;
work++;
if ((*work != '/') || (*(work+1) != '/')) goto ErrorExit;
if ((*work != '/') || (*(work+1) != '/')) goto SuccessExit;
pl->pUserName = work + 2;
work = URL_ScanID(pl->pUserName, &pl->szUserName, USERPASS);
if (*work == ':' ) {
@ -1979,6 +1979,7 @@ static LONG URL_ParseUrl(LPCWSTR pszUrl, WINE_PARSE_URL *pl)
pl->pQuery = strchrW(work, '?');
if (pl->pQuery) pl->szQuery = strlenW(pl->pQuery);
}
SuccessExit:
TRACE("parse successful: scheme=%p(%d), user=%p(%d), pass=%p(%d), host=%p(%d), port=%p(%d), query=%p(%d)\n",
pl->pScheme, pl->szScheme,
pl->pUserName, pl->szUserName,