[PATCH 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 -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9686
From: Tobias Gruetzmacher <tobias-git(a)23.gs> --- dlls/winhttp/session.c | 3 +++ dlls/winhttp/tests/winhttp.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index e26fdd0b377..d32d1bbbb6b 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -2246,6 +2246,9 @@ 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 ); diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c index 760a44a4058..4f03bd79a6a 100644 --- a/dlls/winhttp/tests/winhttp.c +++ b/dlls/winhttp/tests/winhttp.c @@ -5767,6 +5767,16 @@ static void test_WinHttpGetProxyForUrl(int port) GlobalFree( info.lpszProxy ); } + 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
Hans Leidekker (@hans) commented about dlls/winhttp/tests/winhttp.c:
GlobalFree( info.lpszProxy ); }
+ 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);
You should zero 'info' before calling WinHttpGetProxyForUrl(): `memset( &info, 0, sizeof(info) );` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9686#note_125126
Hans Leidekker (@hans) commented about dlls/winhttp/session.c:
{ ret = run_script( script, size, url, info, options->dwFlags ); free( script ); + } else if (options->dwFlags & WINHTTP_AUTOPROXY_ALLOW_STATIC)
Please put 'else if ...' on a new line. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9686#note_125127
Thanks for the patch. I have a few minor comments. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9686#note_125128
participants (3)
-
Hans Leidekker (@hans) -
Tobias Gruetzmacher -
Tobias Gruetzmacher (@TobiX)