curl-cpp
static c++17 wrapper for curl with -fno-exceptions support
|
Public Types | |
enum | Options { none = CURL_LOCK_DATA_NONE, cookie = CURL_LOCK_DATA_COOKIE, Options::dns = CURL_LOCK_DATA_DNS, Options::ssl_session = CURL_LOCK_DATA_SSL_SESSION, Options::connection_cache = CURL_LOCK_DATA_CONNECT, Options::psl = CURL_LOCK_DATA_PSL } |
using | lock_function_t = void(*)(CURL *handle, curl_lock_data data, curl_lock_access access, void *userptr) |
using | unlock_function_t = void(*)(CURL *handle, curl_lock_data data, void *userptr) |
Public Member Functions | |
Share_base (curl_t::Share_t &&share) noexcept | |
Share_base (const Share_base &)=delete | |
Share_base (Share_base &&other) noexcept | |
Share_base & | operator= (const Share_base &)=delete |
Share_base & | operator= (Share_base &&other) noexcept |
operator bool () const noexcept | |
void | add_lock (lock_function_t lock_func, unlock_function_t unlock_func, void *userptr) noexcept |
auto | enable_sharing (Options option) noexcept -> Ret_except< int, std::bad_alloc > |
void | disable_sharing (Options option) noexcept |
void | add_easy (Easy_ref_t &easy) noexcept |
void | remove_easy (Easy_ref_t &easy) noexcept |
Protected Attributes | |
curl_t::Share_t | curl_share |
Definition at line 21 of file curl_share.hpp.
using curl::Share_base::lock_function_t = void (*)(CURL *handle, curl_lock_data data, curl_lock_access access, void *userptr) |
Possible value of data: same as enum class Options
Possible value of access:
Definition at line 126 of file curl_share.hpp.
using curl::Share_base::unlock_function_t = void (*)(CURL *handle, curl_lock_data data, void *userptr) |
Possible value of data: same as enum class Options
Possible value of access:
Definition at line 135 of file curl_share.hpp.
|
strong |
Defines data to share among Easy_t handles.
Enumerator | |
---|---|
dns | share cached DNS hosts. If the libcurl has cookies disabled, then enable_sharing(Options::cookie) will return 0. NOTE that Multi_t interface share this by default without setting this option. |
ssl_session | SSL session IDs will be shared across the easy handles using this shared object. This will reduce the time spent in the SSL handshake when reconnecting to the same server. If curl_t::has_ssl_session_sharing_support() == false, setting this option shares nothing. NOTE SSL session IDs are reused within the same easy handle by default. |
connection_cache | If curl_t::has_connection_cache_sharing_support() == false, setting this option shares nothing. NOTE that Multi_t interface share this by default without setting this option. |
psl | Share Public Suffix List. If curl_t::has_psl_sharing_support() == false, setting this option shares nothing. NOTE that Multi_t interface share this by default without setting this option. |
Definition at line 72 of file curl_share.hpp.
|
noexcept |
share | must be != nullptr |
After this ctor call, share.get() == nullptr, this class will take over the ownership.
Definition at line 15 of file curl_share.cc.
|
delete |
Since libcurl doesn't provide a dup function for curl_share, neither will Share_base.
|
noexcept |
other | bool(other) can be false, but then this new instance of Share_base will be unusable. |
Definition at line 19 of file curl_share.cc.
|
delete |
Since libcurl doesn't provide a dup function for curl_share, neither will Share_base.
|
noexcept |
other | if bool(other) is true, then it will be unusable after this operation. Otherwise, this object will also be destroyed. |
this | this object can also be an unusable object which bool(*this) is false. Calling this function on an unusable object will make that object again usable. |
NOTE that if this object still holds easy handler and bool(other) is false, then it is undefined behavior.
Definition at line 22 of file curl_share.cc.
|
noexcept |
Definition at line 28 of file curl_share.cc.
|
noexcept |
Setting lock_func and unlock_func to nullptr disable locking.
Definition at line 33 of file curl_share.cc.
|
noexcept |
option | must be one of enum class Options. Cannot be or-ed value. |
All sharing enable/disable must be done when no easy is added or all easy is removed.
Definition at line 40 of file curl_share.cc.
|
noexcept |
option | must be one of enum class Options. Cannot be or-ed value. |
All sharing enable/disable must be done when no easy is added or all easy is removed.
Definition at line 50 of file curl_share.cc.