WinHTTP: Add http_proxy_info

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2025-02-14 15:45:57 +01:00
parent e287d62fbc
commit 3053b98ab8

View File

@ -96,5 +96,49 @@ namespace winstd
} }
}; };
///
/// WINHTTP_PROXY_INFO wrapper class
///
/// \sa [WinHttpGetProxyForUrl function](https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpgetproxyforurl)
///
struct http_proxy_info : public WINHTTP_PROXY_INFO
{
http_proxy_info()
{
dwAccessType = 0;
lpszProxy = NULL;
lpszProxyBypass = NULL;
}
http_proxy_info(_Inout_ WINHTTP_PROXY_INFO&& other)
{
dwAccessType = other.dwAccessType;
lpszProxy = other.lpszProxy;
other.lpszProxy = NULL;
lpszProxyBypass = other.lpszProxyBypass;
other.lpszProxyBypass = NULL;
}
http_proxy_info& operator=(_Inout_ WINHTTP_PROXY_INFO&& other)
{
if (this != std::addressof(other)) {
dwAccessType = other.dwAccessType;
if (lpszProxy) GlobalFree(lpszProxy);
lpszProxy = other.lpszProxy;
other.lpszProxy = NULL;
if (lpszProxyBypass) GlobalFree(lpszProxyBypass);
lpszProxyBypass = other.lpszProxyBypass;
other.lpszProxyBypass = NULL;
}
return *this;
}
~http_proxy_info()
{
if (lpszProxy) GlobalFree(lpszProxy);
if (lpszProxyBypass) GlobalFree(lpszProxyBypass);
}
};
/// @} /// @}
} }