MCPcopy Create free account
hub / github.com/chronoxor/CppServer / HTTPSClient

Class HTTPSClient

include/server/http/https_client.h:31–166  ·  view source on GitHub ↗

HTTPS client ! HTTPS client is used to communicate with secured HTTPS Web server. It allows to send GET, POST, PUT, DELETE requests and receive HTTP result using secure transport. Thread-safe. */

Source from the content-addressed store, hash-verified

29 Thread-safe.
30*/
31class HTTPSClient : public Asio::SSLClient
32{
33public:
34 using SSLClient::SSLClient;
35
36 HTTPSClient(const HTTPSClient&) = delete;
37 HTTPSClient(HTTPSClient&&) = delete;
38 virtual ~HTTPSClient() = default;
39
40 HTTPSClient& operator=(const HTTPSClient&) = delete;
41 HTTPSClient& operator=(HTTPSClient&&) = delete;
42
43 //! Get the HTTP request
44 HTTPRequest& request() noexcept { return _request; }
45 const HTTPRequest& request() const noexcept { return _request; }
46
47 //! Send the current HTTP request (synchronous)
48 /*!
49 \return Size of sent data
50 */
51 size_t SendRequest() { return SendRequest(_request); }
52 //! Send the HTTP request (synchronous)
53 /*!
54 \param request - HTTP request
55 \return Size of sent data
56 */
57 size_t SendRequest(const HTTPRequest& request) { return Send(request.cache()); }
58
59 //! Send the HTTP request body (synchronous)
60 /*!
61 \param body - HTTP request body
62 \return Size of sent data
63 */
64 size_t SendRequestBody(std::string_view body) { return Send(body); }
65 //! Send the HTTP request body (synchronous)
66 /*!
67 \param buffer - HTTP request body buffer
68 \param size - HTTP request body size
69 \return Size of sent data
70 */
71 size_t SendRequestBody(const void* buffer, size_t size) { return Send(buffer, size); }
72
73 //! Send the current HTTP request with timeout (synchronous)
74 /*!
75 \param timeout - Timeout
76 \return Size of sent data
77 */
78 size_t SendRequest(const CppCommon::Timespan& timeout) { return SendRequest(_request, timeout); }
79 //! Send the HTTP request with timeout (synchronous)
80 /*!
81 \param request - HTTP request
82 \param timeout - Timeout
83 \return Size of sent data
84 */
85 size_t SendRequest(const HTTPRequest& request, const CppCommon::Timespan& timeout) { return Send(request.cache(), timeout); }
86
87 //! Send the HTTP request body with timeout (synchronous)
88 /*!

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected