[PATCH v2 0/1] MR9686: winhttp: Implement WINHTTP_AUTOPROXY_ALLOW_STATIC
This seems to be a convenience feature to return the static/default proxy config when that is configured. This is a first stab at the "correct" implementation, passes the test and seems right to me, but might be crap. Found in [PyManager](https://github.com/python/pymanager/blob/fa2de8c8820f0b2521cc4e31f1b77c903be...), which at least fails at a different place with this change. :D -- v2: winhttp: Implement WINHTTP_AUTOPROXY_ALLOW_STATIC https://gitlab.winehq.org/wine/wine/-/merge_requests/9686
From: Tobias Gruetzmacher <tobias-git(a)23.gs> --- dlls/winhttp/session.c | 4 ++++ dlls/winhttp/tests/winhttp.c | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index e26fdd0b377..6385e6a97a4 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -2247,6 +2247,10 @@ BOOL WINAPI WinHttpGetProxyForUrl( HINTERNET hsession, LPCWSTR url, WINHTTP_AUTO ret = run_script( script, size, url, info, options->dwFlags ); free( script ); } + else if (options->dwFlags & WINHTTP_AUTOPROXY_ALLOW_STATIC) + { + ret = WinHttpGetDefaultProxyConfiguration( info ); + } release_object( &session->hdr ); if (ret) SetLastError( ERROR_SUCCESS ); diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c index 760a44a4058..600fbd8f107 100644 --- a/dlls/winhttp/tests/winhttp.c +++ b/dlls/winhttp/tests/winhttp.c @@ -5767,6 +5767,17 @@ static void test_WinHttpGetProxyForUrl(int port) GlobalFree( info.lpszProxy ); } + memset( &info, 0, sizeof(info) ); + options.dwFlags = WINHTTP_AUTOPROXY_ALLOW_STATIC|WINHTTP_AUTOPROXY_AUTO_DETECT; + options.dwAutoDetectFlags = WINHTTP_AUTO_DETECT_TYPE_DHCP|WINHTTP_AUTO_DETECT_TYPE_DNS_A; + ret = WinHttpGetProxyForUrl( session, L"http://winehq.com/", &options, &info); + ok(ret, "expected success\n" ); + ok(info.dwAccessType == WINHTTP_ACCESS_TYPE_NO_PROXY, + "info.dwAccessType = %lu\n", info.dwAccessType); + ok(!info.lpszProxy, "info.Proxy = %s\n", wine_dbgstr_w(info.lpszProxy)); + ok(!info.lpszProxyBypass, "info.ProxyBypass = %s\n", + wine_dbgstr_w(info.lpszProxyBypass)); + WinHttpCloseHandle( session ); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9686
On Mon Dec 8 08:25:48 2025 +0000, Hans Leidekker wrote:
You should zero 'info' before calling WinHttpGetProxyForUrl(): `memset( &info, 0, sizeof(info) );` Done, let's see if my assumptions still hold :sweat_smile:
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/9686#note_125173
This merge request was approved by Hans Leidekker. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9686
participants (3)
-
Hans Leidekker (@hans) -
Tobias Gruetzmacher -
Tobias Gruetzmacher (@TobiX)