diff --git a/CHANGELOG b/CHANGELOG index 3e4b15c526..e7fc3471dd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -111,6 +111,8 @@ devel * Foxx: Fix arangoUser sometimes not being set correctly +* fixed issue #1974 + v3.2.alpha2 (2017-02-20) ------------------------ @@ -184,6 +186,9 @@ v3.1.18 (2017-XX-XX) more complicated queries, the maxDepth limit of 1 was not considered strictly enough, causing the traverser to do unlimited depth searches. +* fixed issue #2415 + + v3.1.17 (2017-04-04) -------------------- diff --git a/arangod/Aql/ExecutionNode.cpp b/arangod/Aql/ExecutionNode.cpp index 7ea93671f2..faa97f80b7 100644 --- a/arangod/Aql/ExecutionNode.cpp +++ b/arangod/Aql/ExecutionNode.cpp @@ -1122,7 +1122,7 @@ void ExecutionNode::RegisterPlan::after(ExecutionNode* en) { if (it2 == varInfo.end()) { // report an error here to prevent crashing - THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "missing variable #" + std::to_string(v->id) + " (" + v->name + ") for node " + en->getTypeString() + " while planning registers"); + THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, std::string("missing variable #") + std::to_string(v->id) + " (" + v->name + ") for node #" + std::to_string(en->id()) + " (" + en->getTypeString() + ") while planning registers"); } // finally adjust the variable inside the IN calculation diff --git a/arangod/Aql/OptimizerRules.cpp b/arangod/Aql/OptimizerRules.cpp index c357eb197c..4ecebf9cea 100644 --- a/arangod/Aql/OptimizerRules.cpp +++ b/arangod/Aql/OptimizerRules.cpp @@ -3801,6 +3801,10 @@ void arangodb::aql::inlineSubqueriesRule(Optimizer* opt, RedundantCalculationsReplacer finder(replacements); plan->root()->walk(&finder); + plan->clearVarUsageComputed(); + plan->invalidateCost(); + plan->findVarUsage(); + // abort optimization current = nullptr; } diff --git a/lib/Basics/FileUtils.cpp b/lib/Basics/FileUtils.cpp index 31ea256b68..4d4154cd89 100644 --- a/lib/Basics/FileUtils.cpp +++ b/lib/Basics/FileUtils.cpp @@ -216,9 +216,9 @@ static void throwFileWriteError(int fd, std::string const& filename) { } void spit(std::string const& filename, char const* ptr, size_t len) { - int fd = - TRI_TRACKED_CREATE_FILE(filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC | TRI_O_CLOEXEC, - S_IRUSR | S_IWUSR | S_IRGRP); + int fd = TRI_TRACKED_CREATE_FILE(filename.c_str(), + O_WRONLY | O_CREAT | O_TRUNC | TRI_O_CLOEXEC, + S_IRUSR | S_IWUSR | S_IRGRP); if (fd == -1) { throwFileWriteError(fd, filename); @@ -239,9 +239,9 @@ void spit(std::string const& filename, char const* ptr, size_t len) { } void spit(std::string const& filename, std::string const& content) { - int fd = - TRI_TRACKED_CREATE_FILE(filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC | TRI_O_CLOEXEC, - S_IRUSR | S_IWUSR | S_IRGRP); + int fd = TRI_TRACKED_CREATE_FILE(filename.c_str(), + O_WRONLY | O_CREAT | O_TRUNC | TRI_O_CLOEXEC, + S_IRUSR | S_IWUSR | S_IRGRP); if (fd == -1) { throwFileWriteError(fd, filename); @@ -265,9 +265,9 @@ void spit(std::string const& filename, std::string const& content) { } void spit(std::string const& filename, StringBuffer const& content) { - int fd = - TRI_TRACKED_CREATE_FILE(filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC | TRI_O_CLOEXEC, - S_IRUSR | S_IWUSR | S_IRGRP); + int fd = TRI_TRACKED_CREATE_FILE(filename.c_str(), + O_WRONLY | O_CREAT | O_TRUNC | TRI_O_CLOEXEC, + S_IRUSR | S_IWUSR | S_IRGRP); if (fd == -1) { throwFileWriteError(fd, filename); @@ -623,9 +623,17 @@ std::string dirname(std::string const& name) { void makePathAbsolute(std::string& path) { std::string cwd = FileUtils::currentDirectory().result(); - char* p = TRI_GetAbsolutePath(path.c_str(), cwd.c_str()); - path = p; - TRI_FreeString(TRI_CORE_MEM_ZONE, p); + + if (path.empty()) { + path = cwd; + } else { + char* p = TRI_GetAbsolutePath(path.c_str(), cwd.c_str()); + + if (p != nullptr) { + path = p; + TRI_FreeString(TRI_CORE_MEM_ZONE, p); + } + } } } } diff --git a/lib/SimpleHttpClient/SslClientConnection.cpp b/lib/SimpleHttpClient/SslClientConnection.cpp index 175f969c5c..b7fa211628 100644 --- a/lib/SimpleHttpClient/SslClientConnection.cpp +++ b/lib/SimpleHttpClient/SslClientConnection.cpp @@ -171,7 +171,8 @@ SslClientConnection::SslClientConnection(Endpoint* endpoint, : GeneralClientConnection(endpoint, requestTimeout, connectTimeout, connectRetries), _ssl(nullptr), - _ctx(nullptr) { + _ctx(nullptr), + _sslProtocol(sslProtocol) { TRI_invalidatesocket(&_socket); init(sslProtocol); @@ -185,7 +186,8 @@ SslClientConnection::SslClientConnection(std::unique_ptr& endpoint, : GeneralClientConnection(endpoint, requestTimeout, connectTimeout, connectRetries), _ssl(nullptr), - _ctx(nullptr) { + _ctx(nullptr), + _sslProtocol(sslProtocol) { TRI_invalidatesocket(&_socket); init(sslProtocol); @@ -293,7 +295,14 @@ bool SslClientConnection::connectSocket() { _isConnected = false; return false; } - + + switch (protocol_e(_sslProtocol)) { + case TLS_V1: + case TLS_V12: + default: + SSL_set_tlsext_host_name(_ssl, _endpoint->host().c_str()); + } + SSL_set_connect_state(_ssl); if (SSL_set_fd(_ssl, (int)TRI_get_fd_or_handle_of_socket(_socket)) != 1) { diff --git a/lib/SimpleHttpClient/SslClientConnection.h b/lib/SimpleHttpClient/SslClientConnection.h index 857a64c42c..1dc384de97 100644 --- a/lib/SimpleHttpClient/SslClientConnection.h +++ b/lib/SimpleHttpClient/SslClientConnection.h @@ -131,6 +131,12 @@ class SslClientConnection final : public GeneralClientConnection { ////////////////////////////////////////////////////////////////////////////// SSL_CTX* _ctx; + + ////////////////////////////////////////////////////////////////////////////// + /// @brief SSL version + ////////////////////////////////////////////////////////////////////////////// + + uint64_t _sslProtocol; }; } } diff --git a/lib/V8/v8-utils.cpp b/lib/V8/v8-utils.cpp index dda36d4ed8..ea9242928a 100644 --- a/lib/V8/v8-utils.cpp +++ b/lib/V8/v8-utils.cpp @@ -818,14 +818,25 @@ void JS_Download(v8::FunctionCallbackInfo const& args) { } endpoint = "srv://" + endpoint; } else if (!url.empty() && url[0] == '/') { + size_t found; // relative URL. prefix it with last endpoint relative = url; url = lastEndpoint + url; endpoint = lastEndpoint; if (endpoint.substr(0, 5) == "http:") { - endpoint = "tcp:" + endpoint.substr(5); + endpoint = endpoint.substr(5); + found = endpoint.find(":"); + if (found == std::string::npos) { + endpoint = endpoint + ":80"; + } + endpoint = "tcp:" + endpoint; } else if (endpoint.substr(0, 6) == "https:") { - endpoint = "ssl:" + endpoint.substr(6); + endpoint = endpoint.substr(6); + found = endpoint.find(":"); + if (found == std::string::npos) { + endpoint = endpoint + ":443"; + } + endpoint = "ssl:" + endpoint; } } else { TRI_V8_THROW_SYNTAX_ERROR("unsupported URL specified");