Move stuff into the implementation file.
This commit is contained in:
parent
6f6de3ad5f
commit
4cb99531b1
|
@ -77,7 +77,25 @@ CURLWrapper::~CURLWrapper() noexcept
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CURLWrapper::set_useragent(string_view useragent)
|
string CURLWrapper::escape_url(const string_view url) const
|
||||||
|
{
|
||||||
|
char *cbuf{curl_easy_escape(_connection, url.data(),
|
||||||
|
static_cast<int>(url.size()))};
|
||||||
|
string sbuf{cbuf};
|
||||||
|
curl_free(cbuf);
|
||||||
|
return sbuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
string CURLWrapper::unescape_url(const string_view url) const
|
||||||
|
{
|
||||||
|
char *cbuf{curl_easy_unescape(_connection, url.data(),
|
||||||
|
static_cast<int>(url.size()), nullptr)};
|
||||||
|
string sbuf{cbuf};
|
||||||
|
curl_free(cbuf);
|
||||||
|
return sbuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CURLWrapper::set_useragent(const string_view useragent)
|
||||||
{
|
{
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
||||||
check(curl_easy_setopt(_connection, CURLOPT_USERAGENT, useragent.data()));
|
check(curl_easy_setopt(_connection, CURLOPT_USERAGENT, useragent.data()));
|
||||||
|
|
|
@ -103,14 +103,7 @@ public:
|
||||||
*
|
*
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] inline string escape_url(const string_view url) const
|
[[nodiscard]] string escape_url(string_view url) const;
|
||||||
{
|
|
||||||
char *cbuf{curl_easy_escape(_connection, url.data(),
|
|
||||||
static_cast<int>(url.size()))};
|
|
||||||
string sbuf{cbuf};
|
|
||||||
curl_free(cbuf);
|
|
||||||
return sbuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief URL decodes the given string.
|
* @brief URL decodes the given string.
|
||||||
|
@ -124,14 +117,7 @@ public:
|
||||||
*
|
*
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] inline string unescape_url(const string_view url) const
|
[[nodiscard]] string unescape_url(string_view url) const;
|
||||||
{
|
|
||||||
char *cbuf{curl_easy_unescape(_connection, url.data(),
|
|
||||||
static_cast<int>(url.size()), nullptr)};
|
|
||||||
string sbuf{cbuf};
|
|
||||||
curl_free(cbuf);
|
|
||||||
return sbuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Set the User-Agent.
|
* @brief Set the User-Agent.
|
||||||
|
@ -152,7 +138,7 @@ public:
|
||||||
*
|
*
|
||||||
* @since 0.1.1
|
* @since 0.1.1
|
||||||
*/
|
*/
|
||||||
inline void set_proxy(string_view proxy);
|
void set_proxy(string_view proxy);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Make a HTTP request.
|
* @brief Make a HTTP request.
|
||||||
|
@ -169,7 +155,7 @@ public:
|
||||||
[[nodiscard]] answer make_http_request(http_method method, string_view uri);
|
[[nodiscard]] answer make_http_request(http_method method, string_view uri);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CURL *_connection;
|
CURL *_connection{};
|
||||||
char _buffer_error[CURL_ERROR_SIZE]{};
|
char _buffer_error[CURL_ERROR_SIZE]{};
|
||||||
string _buffer_headers;
|
string _buffer_headers;
|
||||||
string _buffer_body;
|
string _buffer_body;
|
||||||
|
|
Loading…
Reference in New Issue