summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Radomski <github@mintwerk.de>2017-06-01 14:20:31 (GMT)
committerStefan Radomski <github@mintwerk.de>2017-06-01 14:20:31 (GMT)
commitcfa566ab882b416396aba38252992903658f2a8b (patch)
treedb7a697735e8125abfdd49c3845a26f364291f8b /src
parent1e84bbb24e8301ccfcf8ffd98f00447fa566c8a6 (diff)
downloaduscxml-cfa566ab882b416396aba38252992903658f2a8b.zip
uscxml-cfa566ab882b416396aba38252992903658f2a8b.tar.gz
uscxml-cfa566ab882b416396aba38252992903658f2a8b.tar.bz2
SSL support on Win32
Diffstat (limited to 'src')
-rw-r--r--src/uscxml/Interpreter.cpp9
-rw-r--r--src/uscxml/plugins/datamodel/CMakeLists.txt2
-rw-r--r--src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp5
-rw-r--r--src/uscxml/server/HTTPServer.cpp20
4 files changed, 22 insertions, 14 deletions
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index 1a79a63..0758cd1 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -98,7 +98,7 @@ Interpreter Interpreter::fromXML(const std::string& xml, const std::string& base
Interpreter Interpreter::fromElement(XERCESC_NS::DOMElement* scxml, const std::string& baseURL) {
URL absUrl = normalizeURL(baseURL);
-
+
std::shared_ptr<InterpreterImpl> interpreterImpl(new InterpreterImpl());
Interpreter interpreter(interpreterImpl);
@@ -147,6 +147,13 @@ Interpreter Interpreter::fromDocument(XERCESC_NS::DOMDocument* dom, const std::s
Interpreter Interpreter::fromURL(const std::string& url) {
URL absUrl = normalizeURL(url);
+#ifdef _WIN32
+ // Xercesc is hard to build with SSL on windows, whereas curl uses winssl
+ if (absUrl.scheme() == "https") {
+ return fromXML(absUrl.getInContent(), absUrl);
+ }
+#endif
+
std::shared_ptr<InterpreterImpl> interpreterImpl(new InterpreterImpl());
Interpreter interpreter(interpreterImpl);
diff --git a/src/uscxml/plugins/datamodel/CMakeLists.txt b/src/uscxml/plugins/datamodel/CMakeLists.txt
index e70598e..a03e7c8 100644
--- a/src/uscxml/plugins/datamodel/CMakeLists.txt
+++ b/src/uscxml/plugins/datamodel/CMakeLists.txt
@@ -72,7 +72,7 @@ if (V8_FOUND)
endif()
-if (LUA51_FOUND AND WITH_DM_LUA)
+if (LUA_FOUND AND WITH_DM_LUA)
set(USCXML_DATAMODELS "lua ${USCXML_DATAMODELS}")
# Lua ecmascript datamodel
file(GLOB LUA_DATAMODEL
diff --git a/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp b/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp
index 4f78e7d..92866ee 100644
--- a/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp
@@ -163,9 +163,10 @@ static luabridge::LuaRef getDataAsLua(lua_State* _luaState, const Data& data) {
luaData = luabridge::newTable(_luaState);
std::map<std::string, Data>::const_iterator compoundIter = data.compound.begin();
while(compoundIter != data.compound.end()) {
- if (isInteger(compoundIter->first.c_str(), 10) && strTo<size_t>(compoundIter->first) > 0) {
+ if (isInteger(compoundIter->first.c_str(), 10) && strTo<long>(compoundIter->first) > 0) {
// it makes a difference whether we pass a numeric string or a proper number!
- luaData[strTo<size_t>(compoundIter->first)] = getDataAsLua(_luaState, compoundIter->second);
+ // MSVC throws assertion with LuaBridge for size_t instead of int
+ luaData[strTo<long>(compoundIter->first)] = getDataAsLua(_luaState, compoundIter->second);
} else {
luaData[compoundIter->first] = getDataAsLua(_luaState, compoundIter->second);
}
diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp
index 367df21..e9a1039 100644
--- a/src/uscxml/server/HTTPServer.cpp
+++ b/src/uscxml/server/HTTPServer.cpp
@@ -49,6 +49,10 @@ extern "C" {
#include <unistd.h> // for gethostname
//#include <netdb.h>
//#include <arpa/inet.h>
+#else
+#ifdef HTTPS_ENABLED
+#define EVENT__HAVE_OPENSSL
+#endif
#endif
#ifdef HTTPS_ENABLED
@@ -125,6 +129,7 @@ HTTPServer::HTTPServer(unsigned short port, unsigned short wsPort, SSLConfig* ss
SSL_library_init ();
SSL_load_error_strings ();
+ ERR_load_crypto_strings();
OpenSSL_add_all_algorithms ();
SSL_CTX *ctx = SSL_CTX_new (SSLv23_server_method ());
@@ -135,31 +140,26 @@ HTTPServer::HTTPServer(unsigned short port, unsigned short wsPort, SSLConfig* ss
EC_KEY *ecdh = EC_KEY_new_by_curve_name (NID_X9_62_prime256v1);
if (! ecdh) {
- LOGD(USCXML_ERROR) << ("EC_KEY_new_by_curve_name");
- ERR_print_errors_fp(stderr);
+ LOGD(USCXML_ERROR) << ("EC_KEY_new_by_curve_name") << ERR_error_string(ERR_get_error(), NULL);
goto FAIL_SSL_SETUP;
}
if (1 != SSL_CTX_set_tmp_ecdh (ctx, ecdh)) {
- LOGD(USCXML_ERROR) << ("SSL_CTX_set_tmp_ecdh");
- ERR_print_errors_fp(stderr);
+ LOGD(USCXML_ERROR) << ("SSL_CTX_set_tmp_ecdh") << ERR_error_string(ERR_get_error(), NULL);
goto FAIL_SSL_SETUP;
}
if (1 != SSL_CTX_use_certificate_chain_file(ctx, sslConf->publicKey.c_str())) {
- LOGD(USCXML_ERROR) << ("SSL_CTX_use_certificate_chain_file");
- ERR_print_errors_fp(stderr);
+ LOGD(USCXML_ERROR) << ("SSL_CTX_use_certificate_chain_file") << ERR_error_string(ERR_get_error(), NULL);
goto FAIL_SSL_SETUP;
}
if (1 != SSL_CTX_use_PrivateKey_file(ctx, sslConf->privateKey.c_str(), SSL_FILETYPE_PEM)) {
- LOGD(USCXML_ERROR) << ("SSL_CTX_use_PrivateKey_file");
- ERR_print_errors_fp(stderr);
+ LOGD(USCXML_ERROR) << ("SSL_CTX_use_PrivateKey_file") << ERR_error_string(ERR_get_error(), NULL);
goto FAIL_SSL_SETUP;
}
if (1 != SSL_CTX_check_private_key(ctx)) {
- LOGD(USCXML_ERROR) << ("SSL_CTX_check_private_key");
- ERR_print_errors_fp(stderr);
+ LOGD(USCXML_ERROR) << ("SSL_CTX_check_private_key") << ERR_error_string(ERR_get_error(), NULL);
goto FAIL_SSL_SETUP;
}