WinHTTP: Add http_proxy_info
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
e287d62fbc
commit
3053b98ab8
@ -20,7 +20,7 @@
|
||||
///
|
||||
/// \sa [WinHttpQueryHeaders function](https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpqueryheaders)
|
||||
///
|
||||
inline _Success_(return) BOOL WinHttpQueryHeaders(_In_ HINTERNET hRequest, _In_ DWORD dwInfoLevel, _Out_ DWORD& dwData)
|
||||
inline _Success_(return) BOOL WinHttpQueryHeaders(_In_ HINTERNET hRequest, _In_ DWORD dwInfoLevel, _Out_ DWORD & dwData)
|
||||
{
|
||||
DWORD dwSize = sizeof(dwData);
|
||||
if (WinHttpQueryHeaders(hRequest, dwInfoLevel | WINHTTP_QUERY_FLAG_NUMBER, WINHTTP_HEADER_NAME_BY_INDEX, &dwData, &dwSize, WINHTTP_NO_HEADER_INDEX)) {
|
||||
@ -35,7 +35,7 @@ inline _Success_(return) BOOL WinHttpQueryHeaders(_In_ HINTERNET hRequest, _In_
|
||||
///
|
||||
/// \sa [WinHttpQueryHeaders function](https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpqueryheaders)
|
||||
///
|
||||
inline _Success_(return) BOOL WinHttpQueryHeaders(_In_ HINTERNET hRequest, _In_ DWORD dwInfoLevel, _Inout_ std::wstring& sData)
|
||||
inline _Success_(return) BOOL WinHttpQueryHeaders(_In_ HINTERNET hRequest, _In_ DWORD dwInfoLevel, _Inout_ std::wstring & sData)
|
||||
{
|
||||
DWORD dwSize = 0x100;
|
||||
for (;;) {
|
||||
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user