wininet: If necessary, add a slash between the hostname and path in
InternetCreateUrlW.
This commit is contained in:
parent
8eab78c235
commit
d3047aaeba
|
@ -3781,7 +3781,11 @@ 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))
|
||||
{
|
||||
|
@ -4011,6 +4015,13 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
|
|||
dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, HostName);
|
||||
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))
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#define CREATE_URL7 "http://username:password@www.winehq.org:42/site/about"
|
||||
#define CREATE_URL8 "https://username:password@www.winehq.org/site/about"
|
||||
#define CREATE_URL9 "about:blank"
|
||||
#define CREATE_URL10 "about://host/blank"
|
||||
|
||||
static HANDLE hCompleteEvent;
|
||||
|
||||
|
@ -1109,6 +1110,7 @@ static void InternetCreateUrlA_test(void)
|
|||
urlComp.lpszUrlPath = "blank";
|
||||
urlComp.dwUrlPathLength = 5;
|
||||
len = strlen(CREATE_URL9);
|
||||
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");
|
||||
|
@ -1116,6 +1118,21 @@ static void InternetCreateUrlA_test(void)
|
|||
ok(!strcmp(szUrl, CREATE_URL9), "Expected %s, got %s\n", CREATE_URL9, szUrl);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, szUrl);
|
||||
|
||||
memset(&urlComp, 0, sizeof(urlComp));
|
||||
urlComp.dwStructSize = sizeof(URL_COMPONENTS);
|
||||
urlComp.lpszScheme = "about";
|
||||
urlComp.lpszHostName = "host";
|
||||
urlComp.lpszUrlPath = "blank";
|
||||
len = strlen(CREATE_URL10);
|
||||
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_URL10), "Expected len %d, got %ld\n", strlen(CREATE_URL9), len);
|
||||
ok(!strcmp(szUrl, CREATE_URL10), "Expected %s, got %s\n", CREATE_URL9, szUrl);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, szUrl);
|
||||
}
|
||||
|
||||
static void HttpSendRequestEx_test(void)
|
||||
|
|
Loading…
Reference in New Issue