Commit b0fcaf9d authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

wininet: Further InternetCreateFileW fixes.

- Add the slash after the port number. - Only add the port number if the host name is present.
parent d3047aae
......@@ -3783,9 +3783,6 @@ static BOOL calc_url_length(LPURL_COMPONENTSW lpUrlComponents,
if (lpUrlComponents->lpszHostName)
{
*lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, HostName);
if (lpUrlComponents->lpszUrlPath && *lpUrlComponents->lpszUrlPath != '/')
(*lpdwUrlLength)++; /* '/' */
}
if (!url_uses_default_port(nScheme, lpUrlComponents->nPort))
{
......@@ -3796,7 +3793,13 @@ static BOOL calc_url_length(LPURL_COMPONENTSW lpUrlComponents,
*lpdwUrlLength += strlen(":");
}
if (lpUrlComponents->lpszUrlPath && *lpUrlComponents->lpszUrlPath != '/')
(*lpdwUrlLength)++; /* '/' */
}
if (lpUrlComponents->lpszUrlPath)
*lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, UrlPath);
return TRUE;
}
......@@ -4016,14 +4019,6 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
memcpy(lpszUrl, lpUrlComponents->lpszHostName, dwLen * sizeof(WCHAR));
lpszUrl += dwLen;
/* add slash between hostname and path if necessary */
if (lpUrlComponents->lpszUrlPath && *lpUrlComponents->lpszUrlPath != '/')
{
*lpszUrl = '/';
lpszUrl++;
}
}
if (!url_uses_default_port(nScheme, lpUrlComponents->nPort))
{
WCHAR szPort[MAX_WORD_DIGITS];
......@@ -4036,9 +4031,21 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
lpszUrl += dwLen;
}
/* add slash between hostname and path if necessary */
if (lpUrlComponents->lpszUrlPath && *lpUrlComponents->lpszUrlPath != '/')
{
*lpszUrl = '/';
lpszUrl++;
}
}
if (lpUrlComponents->lpszUrlPath)
{
dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, UrlPath);
memcpy(lpszUrl, lpUrlComponents->lpszUrlPath, dwLen * sizeof(WCHAR));
lpszUrl += dwLen;
}
*lpszUrl = '\0';
......
......@@ -49,6 +49,7 @@
#define CREATE_URL8 "https://username:password@www.winehq.org/site/about"
#define CREATE_URL9 "about:blank"
#define CREATE_URL10 "about://host/blank"
#define CREATE_URL11 "about:"
static HANDLE hCompleteEvent;
......@@ -1129,8 +1130,22 @@ static void InternetCreateUrlA_test(void)
szUrl = (char *)HeapAlloc(GetProcessHeap(), 0, ++len);
ret = InternetCreateUrlA(&urlComp, ICU_ESCAPE, szUrl, &len);
ok(ret, "Expected success\n");
ok(len == strlen(CREATE_URL10), "Expected len %d, got %ld\n", strlen(CREATE_URL9), len);
ok(!strcmp(szUrl, CREATE_URL10), "Expected %s, got %s\n", CREATE_URL9, szUrl);
ok(len == strlen(CREATE_URL10), "Expected len %d, got %ld\n", strlen(CREATE_URL10), len);
ok(!strcmp(szUrl, CREATE_URL10), "Expected %s, got %s\n", CREATE_URL10, szUrl);
HeapFree(GetProcessHeap(), 0, szUrl);
memset(&urlComp, 0, sizeof(urlComp));
urlComp.dwStructSize = sizeof(URL_COMPONENTS);
urlComp.nPort = 8080;
urlComp.lpszScheme = "about";
len = strlen(CREATE_URL11);
len++; /* work around bug in native wininet */
szUrl = (char *)HeapAlloc(GetProcessHeap(), 0, ++len);
ret = InternetCreateUrlA(&urlComp, ICU_ESCAPE, szUrl, &len);
ok(ret, "Expected success\n");
ok(len == strlen(CREATE_URL11), "Expected len %d, got %ld\n", strlen(CREATE_URL11), len);
ok(!strcmp(szUrl, CREATE_URL11), "Expected %s, got %s\n", CREATE_URL11, szUrl);
HeapFree(GetProcessHeap(), 0, szUrl);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment