From c0400560b54458335b77af847c46a65722199af3 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 23 May 2012 18:24:02 +0200 Subject: [PATCH] wininet: Moved querying INTERNET_OPTION_REQUEST_FLAGS implementation to HTTPREQ_QueryOption. --- dlls/wininet/http.c | 10 ++++++++++ dlls/wininet/internet.c | 20 ++++++++------------ dlls/wininet/tests/internet.c | 16 ++++++++++++++++ 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index da102824b62..f26f45f8df0 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -2157,6 +2157,16 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe *size = sizeof(DWORD); *(DWORD *)buffer = req->connect_timeout; + return ERROR_SUCCESS; + case INTERNET_OPTION_REQUEST_FLAGS: + TRACE("INTERNET_OPTION_REQUEST_FLAGS\n"); + + if (*size < sizeof(DWORD)) + return ERROR_INSUFFICIENT_BUFFER; + + *(DWORD*)buffer = 4; + *size = sizeof(DWORD); + return ERROR_SUCCESS; } diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 66f25ebc7bd..a41225f97c9 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -1214,7 +1214,7 @@ HINTERNET WINAPI InternetConnectW(HINTERNET hInternet, HINTERNET rc = NULL; DWORD res = ERROR_SUCCESS; - TRACE("(%p, %s, %i, %s, %s, %i, %i, %lx)\n", hInternet, debugstr_w(lpszServerName), + TRACE("(%p, %s, %i, %s, %s, %i, %x, %lx)\n", hInternet, debugstr_w(lpszServerName), nServerPort, debugstr_w(lpszUserName), debugstr_w(lpszPassword), dwService, dwFlags, dwContext); @@ -2319,17 +2319,6 @@ static DWORD query_global_option(DWORD option, void *buffer, DWORD *size, BOOL u /* FIXME: This function currently handles more options than it should. Options requiring * proper handles should be moved to proper functions */ switch(option) { - case INTERNET_OPTION_REQUEST_FLAGS: - TRACE("INTERNET_OPTION_REQUEST_FLAGS\n"); - - if (*size < sizeof(ULONG)) - return ERROR_INSUFFICIENT_BUFFER; - - *(ULONG*)buffer = 4; - *size = sizeof(ULONG); - - return ERROR_SUCCESS; - case INTERNET_OPTION_HTTP_VERSION: if (*size < sizeof(HTTP_VERSION_INFO)) return ERROR_INSUFFICIENT_BUFFER; @@ -2471,7 +2460,9 @@ static DWORD query_global_option(DWORD option, void *buffer, DWORD *size, BOOL u return res; } + case INTERNET_OPTION_REQUEST_FLAGS: case INTERNET_OPTION_USER_AGENT: + *size = 0; return ERROR_INTERNET_INCORRECT_HANDLE_TYPE; case INTERNET_OPTION_POLICY: return ERROR_INVALID_PARAMETER; @@ -2509,6 +2500,11 @@ DWORD INET_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD * *size = sizeof(DWORD_PTR); return ERROR_SUCCESS; + case INTERNET_OPTION_REQUEST_FLAGS: + WARN("INTERNET_OPTION_REQUEST_FLAGS\n"); + *size = sizeof(DWORD); + return ERROR_INTERNET_INCORRECT_HANDLE_TYPE; + case INTERNET_OPTION_MAX_CONNS_PER_SERVER: case INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER: WARN("Called on global option %u\n", option); diff --git a/dlls/wininet/tests/internet.c b/dlls/wininet/tests/internet.c index 8d916610861..3567cc82391 100644 --- a/dlls/wininet/tests/internet.c +++ b/dlls/wininet/tests/internet.c @@ -212,6 +212,22 @@ static void test_InternetQueryOptionA(void) ok(retval == 0,"Got wrong return value %d\n",retval); ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code %d\n",err); + SetLastError(0xdeadbeef); + len = sizeof(DWORD); + retval = InternetQueryOptionA(hurl,INTERNET_OPTION_REQUEST_FLAGS,NULL,&len); + err = GetLastError(); + ok(retval == 0,"Got wrong return value %d\n",retval); + ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code %d\n",err); + ok(len == sizeof(DWORD), "len = %d\n", len); + + SetLastError(0xdeadbeef); + len = sizeof(DWORD); + retval = InternetQueryOptionA(NULL,INTERNET_OPTION_REQUEST_FLAGS,NULL,&len); + err = GetLastError(); + ok(retval == 0,"Got wrong return value %d\n",retval); + ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code %d\n",err); + ok(!len, "len = %d\n", len); + InternetCloseHandle(hurl); InternetCloseHandle(hinet);