wininet: Only accept proxy and proxy bypass if type is INTERNET_OPEN_TYPE_PROXY.
This commit is contained in:
parent
73895b3279
commit
d3308e6f09
|
@ -1015,6 +1015,11 @@ HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType,
|
|||
/* Clear any error information */
|
||||
INTERNET_SetLastError(0);
|
||||
|
||||
if((dwAccessType == INTERNET_OPEN_TYPE_PROXY) && !lpszProxy) {
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lpwai = alloc_object(NULL, &APPINFOVtbl, sizeof(appinfo_t));
|
||||
if (!lpwai) {
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
|
@ -1031,9 +1036,10 @@ HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType,
|
|||
lpwai->agent = heap_strdupW(lpszAgent);
|
||||
if(dwAccessType == INTERNET_OPEN_TYPE_PRECONFIG)
|
||||
INTERNET_ConfigureProxy( lpwai );
|
||||
else
|
||||
else if(dwAccessType == INTERNET_OPEN_TYPE_PROXY) {
|
||||
lpwai->proxy = heap_strdupW(lpszProxy);
|
||||
lpwai->proxyBypass = heap_strdupW(lpszProxyBypass);
|
||||
lpwai->proxyBypass = heap_strdupW(lpszProxyBypass);
|
||||
}
|
||||
|
||||
TRACE("returning %p\n", lpwai);
|
||||
|
||||
|
|
|
@ -2170,7 +2170,7 @@ out:
|
|||
static void test_proxy_direct(int port)
|
||||
{
|
||||
HINTERNET hi, hc, hr;
|
||||
DWORD r, sz;
|
||||
DWORD r, sz, error;
|
||||
char buffer[0x40], *url;
|
||||
WCHAR bufferW[0x40];
|
||||
static CHAR username[] = "mike",
|
||||
|
@ -2181,6 +2181,14 @@ static void test_proxy_direct(int port)
|
|||
passwordW[] = {'1','1','0','1',0},
|
||||
useragentW[] = {'w','i','n','e','t','e','s','t',0};
|
||||
|
||||
/* specify proxy type without the proxy and bypass */
|
||||
SetLastError(0xdeadbeef);
|
||||
hi = InternetOpen(NULL, INTERNET_OPEN_TYPE_PROXY, NULL, NULL, 0);
|
||||
error = GetLastError();
|
||||
ok(error == ERROR_INVALID_PARAMETER ||
|
||||
broken(error == ERROR_SUCCESS) /* WinXPProSP2 */, "got %u\n", error);
|
||||
ok(hi == NULL || broken(!!hi) /* WinXPProSP2 */, "open should have failed\n");
|
||||
|
||||
sprintf(buffer, "localhost:%d\n", port);
|
||||
hi = InternetOpen(NULL, INTERNET_OPEN_TYPE_PROXY, buffer, NULL, 0);
|
||||
ok(hi != NULL, "open failed\n");
|
||||
|
|
Loading…
Reference in New Issue