userver: userver/clients/http/connect_to.hpp Source File
Loading...
Searching...
No Matches
connect_to.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/clients/http/connect_to.hpp
4/// @brief @copybrief clients::http::ConnectTo
5
6#include <string>
7
8USERVER_NAMESPACE_BEGIN
9
10namespace curl::native {
11struct curl_slist;
12}
13
14namespace clients::http {
15
16/// @brief CURLOPT_CONNECT_TO argument for curl's connect_to().
17///
18/// @warning ConnectTo passed to connect_to() must outlive http's Request as
19/// it holds curl's slist value.
20class ConnectTo final {
21 public:
22 ConnectTo(ConnectTo&&) noexcept;
23
24 ConnectTo(const ConnectTo&) = delete;
25
26 explicit ConnectTo(const std::string& value);
27
28 ~ConnectTo();
29
30 ConnectTo& operator=(const ConnectTo&) = delete;
31
32 ConnectTo& operator=(ConnectTo&&) noexcept;
33
34 curl::native::curl_slist* GetUnderlying() const noexcept;
35
36 private:
37 curl::native::curl_slist* value_{nullptr};
38};
39
40} // namespace clients::http
41
42USERVER_NAMESPACE_END