Add winstd::http
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
c1bd614597
commit
d99aedecc1
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
SPDX-License-Identifier: MIT
|
SPDX-License-Identifier: MIT
|
||||||
Copyright © 1991-2023 Amebis
|
Copyright © 1991-2023 Amebis
|
||||||
Copyright © 2016 GÉANT
|
Copyright © 2016 GÉANT
|
||||||
|
53
include/WinStd/WinHTTP.h
Normal file
53
include/WinStd/WinHTTP.h
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
SPDX-License-Identifier: MIT
|
||||||
|
Copyright © 1991-2023 Amebis
|
||||||
|
Copyright © 2016 GÉANT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// \defgroup WinStdWinHTTP Windows HTTP Client
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Common.h"
|
||||||
|
#include <winhttp.h>
|
||||||
|
|
||||||
|
namespace winstd
|
||||||
|
{
|
||||||
|
/// \addtogroup WinStdWinHTTP
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// HTTP handle wrapper class
|
||||||
|
///
|
||||||
|
/// \sa [WinHttpOpen function](https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpopen)
|
||||||
|
///
|
||||||
|
class http : public handle<HINTERNET, NULL>
|
||||||
|
{
|
||||||
|
WINSTD_HANDLE_IMPL(http, NULL)
|
||||||
|
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
/// Closes a handle to the HTTP.
|
||||||
|
///
|
||||||
|
/// \sa [WinHttpCloseHandle function](https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpclosehandle)
|
||||||
|
///
|
||||||
|
virtual ~http()
|
||||||
|
{
|
||||||
|
if (m_h != invalid)
|
||||||
|
free_internal();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
///
|
||||||
|
/// Closes a handle to the HTTP.
|
||||||
|
///
|
||||||
|
/// \sa [WinHttpCloseHandle function](https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpclosehandle)
|
||||||
|
///
|
||||||
|
void free_internal() noexcept override
|
||||||
|
{
|
||||||
|
WinHttpCloseHandle(m_h);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user