allow late init of ssl
This commit is contained in:
@@ -316,6 +316,7 @@ bool HttpClient::parseUrl(const string& url, string* proto, string* host, uint16
|
||||
|
||||
bool HttpClient::connect(const string& host, const uint16_t port, bool https, const string& userAgent,
|
||||
const int timeout) {
|
||||
initialize();
|
||||
disconnect();
|
||||
#ifdef HAVE_SSL
|
||||
m_socket = SSLSocket::connect(host, port, https, timeout, m_caFile, m_caPath);
|
||||
|
||||
@@ -124,8 +124,9 @@ class HttpClient {
|
||||
* Constructor.
|
||||
* @param caFile the CA file to use (uses defaults if neither caFile nor caPath are set), or "#" for insecure.
|
||||
* @param caPath the path with CA files to use (uses defaults if neither caFile nor caPath are set).
|
||||
* @param init whether to immediately initialize the library (instead of during connect()).
|
||||
*/
|
||||
explicit HttpClient(const char* caFile = nullptr, const char* caPath = nullptr) :
|
||||
explicit HttpClient(const char* caFile = nullptr, const char* caPath = nullptr, bool init = true) :
|
||||
#ifdef HAVE_SSL
|
||||
m_https(false),
|
||||
m_caFile(caFile),
|
||||
@@ -133,7 +134,9 @@ class HttpClient {
|
||||
#endif
|
||||
m_socket(nullptr), m_port(0), m_timeout(0), m_bufferSize(0), m_buffer(nullptr)
|
||||
{
|
||||
initialize();
|
||||
if (init) {
|
||||
initialize();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user