diff options
-rw-r--r-- | CMakeLists.txt | 8 | ||||
-rw-r--r-- | src/bindings/swig/php/test.php | 2 | ||||
-rw-r--r-- | src/uscxml/Message.cpp | 4 | ||||
-rw-r--r-- | src/uscxml/URL.cpp | 4 | ||||
-rw-r--r-- | test/src/test-url.cpp | 14 |
5 files changed, 27 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a10872..e6a3d61 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -353,10 +353,16 @@ include_directories(${Boost_INCLUDE_DIR}) # CURL - find_package(CURL REQUIRED) +find_package(OpenSSL REQUIRED) +find_package(ZLIB REQUIRED) + +include_directories(${OPENSSL_INCLUDE_DIR}) +include_directories(${ZLIB_INCLUDE_DIRS}) include_directories(${CURL_INCLUDE_DIRS}) list (APPEND USCXML_CORE_LIBS ${CURL_LIBRARIES}) +list (APPEND USCXML_CORE_LIBS ${OPENSSL_LIBRARIES}) +list (APPEND USCXML_CORE_LIBS ${ZLIB_LIBRARIES}) if (WIN32) add_definitions("-DCURL_STATICLIB") endif() diff --git a/src/bindings/swig/php/test.php b/src/bindings/swig/php/test.php index 66ad658..598c559 100644 --- a/src/bindings/swig/php/test.php +++ b/src/bindings/swig/php/test.php @@ -6,7 +6,7 @@ foreach ($exts as $e) print_r(get_extension_funcs($e)); } -$interpreter = interpreter_fromuri('/Users/sradomski/Documents/TK/Code/uscxml/test/samples/uscxml/test-ecmascript.scxml'); +$interpreter = interpreter_fromuri('https://raw.github.com/tklab-tud/uscxml/master/test/samples/uscxml/test-ecmascript.scxml'); interpreter_interpret($interpreter); ?>
\ No newline at end of file diff --git a/src/uscxml/Message.cpp b/src/uscxml/Message.cpp index c8c4b28..13b0b55 100644 --- a/src/uscxml/Message.cpp +++ b/src/uscxml/Message.cpp @@ -195,12 +195,12 @@ Data Data::fromJSON(const std::string& jsonString) { free(t); // LOG(INFO) << "Increasing JSON length to token ratio to 1/" << frac; } - t = (jsmntok_t*)malloc(nrTokens * sizeof(jsmntok_t)); + t = (jsmntok_t*)malloc(nrTokens * sizeof(jsmntok_t) + 1); if (t == NULL) { LOG(ERROR) << "Cannot parse JSON, ran out of memory!"; return data; } - memset(t, 0, nrTokens * sizeof(jsmntok_t)); + memset(t, 0, nrTokens * sizeof(jsmntok_t) + 1); rv = jsmn_parse(&p, jsonString.c_str(), t, nrTokens); } while (rv == JSMN_ERROR_NOMEM && frac > 1); diff --git a/src/uscxml/URL.cpp b/src/uscxml/URL.cpp index 4a4440d..7036e0a 100644 --- a/src/uscxml/URL.cpp +++ b/src/uscxml/URL.cpp @@ -340,6 +340,9 @@ void URLFetcher::fetchURL(URL& url) { (curlError = curl_easy_setopt(handle, CURLOPT_HEADERDATA, url._impl.get())) == CURLE_OK || LOG(ERROR) << "Cannot register this as header userdata: " << curl_easy_strerror(curlError); + (curlError = curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, false)) == CURLE_OK || + LOG(ERROR) << "Cannot forfeit peer verification: " << curl_easy_strerror(curlError); + if (boost::iequals(url._impl->_requestType, "post")) { @@ -504,6 +507,7 @@ void URLFetcher::perform() { curl_multi_remove_handle(_multiHandle, msg->easy_handle); _handlesToURLs.erase(msg->easy_handle); default: + LOG(ERROR) << "Unhandled curl status"; break; } } else { diff --git a/test/src/test-url.cpp b/test/src/test-url.cpp index 5d497e3..bbe4dbc 100644 --- a/test/src/test-url.cpp +++ b/test/src/test-url.cpp @@ -55,7 +55,7 @@ int main(int argc, char** argv) { HTTPServer::unregisterServlet(testServlet2); HTTPServer::unregisterServlet(testServlet3); } - + { Data data = Data::fromJSON("asdf"); std::cout << data << std::endl; @@ -82,7 +82,19 @@ int main(int argc, char** argv) { assert(iequals(url.port(), "80")); assert(iequals(url.path(), "/index.html")); assert(iequals(url.asString(), "http://www.heise.de/index.html")); + std::stringstream content; + content << url; + } + + { + URL url("https://raw.github.com/tklab-tud/uscxml/master/test/samples/uscxml/test-ecmascript.scxml"); + std::cout << url.asString() << std::endl; + assert(url.isAbsolute()); + assert(iequals(url.scheme(), "https")); + std::stringstream content; + content << url; } + { URL url("file:Document/Text.foo"); std::cout << url.asString() << std::endl; |