fix non-ssl build
This commit is contained in:
+5
-1
@@ -263,7 +263,11 @@ int main(int argc, char* argv[], char* envp[]) {
|
||||
const string lang = MappedFileReader::normalizeLanguage(
|
||||
s_opt.preferLanguage == nullptr || !s_opt.preferLanguage[0] ? "" : s_opt.preferLanguage);
|
||||
string configLocalPrefix, configUriPrefix;
|
||||
#ifdef HAVE_SSL
|
||||
HttpClient::initialize(s_opt.caFile, s_opt.caPath);
|
||||
#else // HAVE_SSL
|
||||
HttpClient::initialize(nullptr, nullptr);
|
||||
#endif // HAVE_SSL
|
||||
HttpClient* configHttpClient = nullptr;
|
||||
string configPath = s_opt.configPath;
|
||||
if (configPath.find("://") == string::npos) {
|
||||
@@ -288,7 +292,7 @@ int main(int argc, char* argv[], char* envp[]) {
|
||||
logWrite(lf_main, ll_error, "invalid configPath URL (HTTPS not supported)"); // force logging on exit
|
||||
return EINVAL;
|
||||
}
|
||||
#endif
|
||||
#endif // HAVE_SSL
|
||||
logWrite(lf_main, ll_error, "invalid configPath URL"); // force logging on exit
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
+2
-1
@@ -63,9 +63,10 @@ typedef struct options {
|
||||
bool injectMessages; //!< inject remaining arguments as already seen messages
|
||||
bool stopAfterInject; //!< only inject messages once, then stop
|
||||
int injectCount; //!< number of message arguments to inject, or 0
|
||||
#ifdef HAVE_SSL
|
||||
const char* caFile; //!< the CA file to use (uses defaults if neither caFile nor caPath are set), or "#" for insecure
|
||||
const char* caPath; //!< the path with CA files to use (uses defaults if neither caFile nor caPath are set)
|
||||
|
||||
#endif // HAVE_SSL
|
||||
symbol_t address; //!< own bus address [31]
|
||||
bool answer; //!< answer to requests from other masters
|
||||
unsigned int acquireTimeout; //!< bus acquisition timeout in ms [10]
|
||||
|
||||
@@ -32,9 +32,9 @@ namespace ebusd {
|
||||
/** the default path of the configuration files. */
|
||||
#ifdef HAVE_SSL
|
||||
#define CONFIG_PATH "https" CONFIG_PATH_SUFFIX
|
||||
#else
|
||||
#else // HAVE_SSL
|
||||
#define CONFIG_PATH "http" CONFIG_PATH_SUFFIX
|
||||
#endif
|
||||
#endif // HAVE_SSL
|
||||
|
||||
/** the default program options. */
|
||||
static const options_t s_default_opt = {
|
||||
@@ -57,9 +57,10 @@ static const options_t s_default_opt = {
|
||||
.injectMessages = false,
|
||||
.stopAfterInject = false,
|
||||
.injectCount = 0,
|
||||
#ifdef HAVE_SSL
|
||||
.caFile = nullptr,
|
||||
.caPath = nullptr,
|
||||
|
||||
#endif // HAVE_SSL
|
||||
.address = 0x31,
|
||||
.answer = false,
|
||||
.acquireTimeout = 10,
|
||||
@@ -345,13 +346,14 @@ static int parse_opt(int key, char *arg, const argParseOpt *parseOpt, struct opt
|
||||
opt->injectMessages = true;
|
||||
opt->stopAfterInject = arg && strcmp("stop", arg) == 0;
|
||||
break;
|
||||
#ifdef HAVE_SSL
|
||||
case O_CAFILE: // --cafile=FILE
|
||||
opt->caFile = arg;
|
||||
break;
|
||||
case O_CAPATH: // --capath=PATH
|
||||
opt->caPath = arg;
|
||||
break;
|
||||
|
||||
#endif // HAVE_SSL
|
||||
// eBUS options:
|
||||
case 'a': // --address=31
|
||||
{
|
||||
|
||||
@@ -298,9 +298,9 @@ void MainLoop::run() {
|
||||
if (!m_httpClient.connect("upd.ebusd.eu",
|
||||
#ifdef HAVE_SSL
|
||||
443, true,
|
||||
#else
|
||||
#else // HAVE_SSL
|
||||
80, false,
|
||||
#endif
|
||||
#endif // HAVE_SSL
|
||||
PACKAGE_NAME "/" PACKAGE_VERSION)) {
|
||||
logError(lf_main, "update check connect error");
|
||||
nextCheckRun = now + CHECK_INITIAL_DELAY;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user