fix non-ssl build

This commit is contained in:
John
2023-11-11 10:19:03 +01:00
parent bceeb5f4f9
commit 15de49cab1
6 changed files with 24 additions and 17 deletions
+6 -6
View File
@@ -344,11 +344,11 @@ bool HttpClient::parseUrl(const string& url, string* proto, string* host, uint16
if (!isSsl && *proto != "http") {
return false;
}
#else
#else // HAVE_SSL
if (*proto != "http") {
return false;
}
#endif
#endif // HAVE_SSL
size_t pos = url.find('/', hostPos);
if (pos == hostPos) {
return false;
@@ -387,12 +387,12 @@ bool HttpClient::connect(const string& host, const uint16_t port, bool https, co
#ifdef HAVE_SSL
m_socket = SSLSocket::connect(host, port, https, timeout, s_caFile, s_caPath);
m_https = https;
#else
#else // HAVE_SSL
if (https) {
return false;
}
m_socket = TCPSocket::connect(host, port, timeout);
#endif
#endif // HAVE_SSL
if (!m_socket) {
return false;
}
@@ -410,9 +410,9 @@ bool HttpClient::reconnect() {
}
#ifdef HAVE_SSL
m_socket = SSLSocket::connect(m_host, m_port, m_https, m_timeout, s_caFile, s_caPath);
#else
#else // HAVE_SSL
m_socket = TCPSocket::connect(m_host, m_port, m_timeout);
#endif
#endif // HAVE_SSL
if (!m_socket) {
return false;
}
+3 -3
View File
@@ -32,7 +32,7 @@
# include <openssl/ssl.h>
# include <openssl/bio.h>
# include <openssl/err.h>
#endif
#endif // HAVE_SSL
/** typedef for referencing @a sockaddr_in within namespace. */
typedef struct sockaddr_in socketaddress;
@@ -122,7 +122,7 @@ class HttpClient {
HttpClient() :
#ifdef HAVE_SSL
m_https(false),
#endif
#endif // HAVE_SSL
m_socket(nullptr), m_port(0), m_timeout(0), m_bufferSize(0), m_buffer(nullptr) {
}
@@ -250,7 +250,7 @@ class HttpClient {
/** the path with CA files to use. */
static const char* s_caPath;
#endif
#endif // HAVE_SSL
/** the currently connected socket. */
SocketClass* m_socket;