diff --git a/include/WinStd/Win.h b/include/WinStd/Win.h index 30057c26..c670ecd3 100644 --- a/include/WinStd/Win.h +++ b/include/WinStd/Win.h @@ -1,4 +1,4 @@ -/* +/* SPDX-License-Identifier: MIT Copyright © 1991-2023 Amebis Copyright © 2016 GÉANT diff --git a/include/WinStd/WinHTTP.h b/include/WinStd/WinHTTP.h new file mode 100644 index 00000000..8dfa4e12 --- /dev/null +++ b/include/WinStd/WinHTTP.h @@ -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 + +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 + { + 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); + } + }; + + /// @} +} \ No newline at end of file