1
0
Fork 0

Merge branch 'devel' of github.com:arangodb/arangodb into devel

This commit is contained in:
Michael Hackstein 2015-02-19 14:53:32 +01:00
commit b64f515f61
8 changed files with 122 additions and 114 deletions

View File

@ -15,9 +15,10 @@ ArangoDB and shouldn't be used if possible.
* Foxx: the signature of method `requestContext.queryParam()` has changed. `requestContext.queryParam({type: "string"})` does not work anymore. Please use `requestContext.queryParam({type: joi.string()})` instead. * Foxx: the signature of method `requestContext.queryParam()` has changed. `requestContext.queryParam({type: "string"})` does not work anymore. Please use `requestContext.queryParam({type: joi.string()})` instead.
* Foxx: the signature of method `requestContext.pathParam()` has changed. `requestContext.pathParam({type: "string"})` does not work anymore. Please use `requestContext.pathParam({type: joi.string()})` instead. * Foxx: the signature of method `requestContext.pathParam()` has changed. `requestContext.pathParam({type: "string"})` does not work anymore. Please use `requestContext.pathParam({type: joi.string()})` instead.
* Foxx: method `Model#toJSONSchema(id)` is deprecated, it will raise a warning if you use it. Please use `Foxx.toJSONSchema(id, model)` instead. * Foxx: method `Model#toJSONSchema(id)` is deprecated, it will raise a warning if you use it. Please use `Foxx.toJSONSchema(id, model)` instead.
* Graphs: The modules `org/arangodb/graph` and `org/arangodb/graph-blueprint` have been removed entirely. Please use module `org/arangodb/general-graph` instead.
* General-Graph: In the module `org/arangodb/general-graph` the functions `_undirectedRelation` and `_directedRelation` are no longer available. Both functions have been unified to `_relation`. * General-Graph: In the module `org/arangodb/general-graph` the functions `_undirectedRelation` and `_directedRelation` are no longer available. Both functions have been unified to `_relation`.
* HTTP API: The api `_api/graph` has been removed entirely. Please use the general graph api `_api/gharial` instead.
* Graphs: The modules `org/arangodb/graph` and `org/arangodb/graph-blueprint` are deprecated. Please use module `org/arangodb/general-graph` instead.
* HTTP API: The api `_api/graph` is deprecated. Please use the general graph api `_api/gharial` instead.
## 2.6 ## 2.6

View File

@ -249,6 +249,9 @@ pkgdataSERVERdir = $(datadir)/arangodb
pkgdataCLIENTdir = $(datadir)/arangodb pkgdataCLIENTdir = $(datadir)/arangodb
pkgdataNODEdir = $(datadir)/arangodb pkgdataNODEdir = $(datadir)/arangodb
pkgdataAPPSdir = $(datadir)/arangodb pkgdataAPPSdir = $(datadir)/arangodb
pkgdataAPPSADMINdir = $(datadir)/arangodb
pkgdataAPPSAPIdir = $(datadir)/arangodb
pkgdataAPPSSYSTEMdir = $(datadir)/arangodb
pkgdataMRUBYdir = $(datadir)/arangodb pkgdataMRUBYdir = $(datadir)/arangodb
nobase_pkgdata_DATA = nobase_pkgdata_DATA =
@ -258,7 +261,12 @@ nobase_pkgdataCOMMON_DATA = $(shell find @srcdir@/js/common -name "*.js" -print)
nobase_pkgdataSERVER_DATA = $(shell find @srcdir@/js/server -name "*.js" -print) nobase_pkgdataSERVER_DATA = $(shell find @srcdir@/js/server -name "*.js" -print)
nobase_pkgdataCLIENT_DATA = $(shell find @srcdir@/js/client -name "*.js" -print) nobase_pkgdataCLIENT_DATA = $(shell find @srcdir@/js/client -name "*.js" -print)
nobase_pkgdataNODE_DATA = $(shell find @srcdir@/js/node -type f "(" -name .travis.yml -o -name .npmignore -o -print ")" | grep -v "\(htmlparser2\|js-yaml\)/test/" ) nobase_pkgdataNODE_DATA = $(shell find @srcdir@/js/node -type f "(" -name .travis.yml -o -name .npmignore -o -print ")" | grep -v "\(htmlparser2\|js-yaml\)/test/" )
nobase_pkgdataAPPS_DATA = $(shell find @srcdir@/js/apps/system -type f "(" -path "*/test/*" -o -path "*/test_data/*" -o -path "*/coverage/*" -o -print ")")
# note: we want to exclude node_modules from aardvark because they are only needed by grunt and not to run aardvark
nobase_pkgdataAPPSADMIN_DATA = $(shell find @srcdir@/js/apps/system/_admin -type f "(" -path "*/node_modules/*" -o -path "*/test/*" -o -path "*/test_data/*" -o -path "*/coverage/*" -o -print ")")
nobase_pkgdataAPPSAPI_DATA = $(shell find @srcdir@/js/apps/system/_api -type f "(" -path "*/test/*" -o -path "*/test_data/*" -o -path "*/coverage/*" -o -print ")")
nobase_pkgdataAPPSSYSTEM_DATA = $(shell find @srcdir@/js/apps/system/_system -type f "(" -path "*/test/*" -o -path "*/test_data/*" -o -path "*/coverage/*" -o -print ")")
if ENABLE_MRUBY if ENABLE_MRUBY

View File

@ -383,10 +383,10 @@ static v8::Handle<v8::Object> RequestCppToV8 (v8::Isolate* isolate,
TRI_GET_GLOBAL_STRING(UserKey); TRI_GET_GLOBAL_STRING(UserKey);
if (user.empty()) { if (user.empty()) {
req->Set(UserKey, v8::Null(isolate)); req->ForceSet(UserKey, v8::Null(isolate));
} }
else { else {
req->Set(UserKey, TRI_V8_STD_STRING(user)); req->ForceSet(UserKey, TRI_V8_STD_STRING(user));
} }
// create database attribute // create database attribute
@ -394,44 +394,44 @@ static v8::Handle<v8::Object> RequestCppToV8 (v8::Isolate* isolate,
TRI_ASSERT(! database.empty()); TRI_ASSERT(! database.empty());
TRI_GET_GLOBAL_STRING(DatabaseKey); TRI_GET_GLOBAL_STRING(DatabaseKey);
req->Set(DatabaseKey, TRI_V8_STD_STRING(database)); req->ForceSet(DatabaseKey, TRI_V8_STD_STRING(database));
// set the full url // set the full url
string const& fullUrl = request->fullUrl(); string const& fullUrl = request->fullUrl();
TRI_GET_GLOBAL_STRING(UrlKey); TRI_GET_GLOBAL_STRING(UrlKey);
req->Set(UrlKey, TRI_V8_STD_STRING(fullUrl)); req->ForceSet(UrlKey, TRI_V8_STD_STRING(fullUrl));
// set the protocol // set the protocol
string const& protocol = request->protocol(); string const& protocol = request->protocol();
TRI_GET_GLOBAL_STRING(ProtocolKey); TRI_GET_GLOBAL_STRING(ProtocolKey);
req->Set(ProtocolKey, TRI_V8_STD_STRING(protocol)); req->ForceSet(ProtocolKey, TRI_V8_STD_STRING(protocol));
// set the connection info // set the connection info
const ConnectionInfo& info = request->connectionInfo(); const ConnectionInfo& info = request->connectionInfo();
v8::Handle<v8::Object> serverArray = v8::Object::New(isolate); v8::Handle<v8::Object> serverArray = v8::Object::New(isolate);
TRI_GET_GLOBAL_STRING(AddressKey); TRI_GET_GLOBAL_STRING(AddressKey);
serverArray->Set(AddressKey, TRI_V8_STD_STRING(info.serverAddress)); serverArray->ForceSet(AddressKey, TRI_V8_STD_STRING(info.serverAddress));
TRI_GET_GLOBAL_STRING(PortKey); TRI_GET_GLOBAL_STRING(PortKey);
serverArray->Set(PortKey, v8::Number::New(isolate, info.serverPort)); serverArray->ForceSet(PortKey, v8::Number::New(isolate, info.serverPort));
TRI_GET_GLOBAL_STRING(ServerKey); TRI_GET_GLOBAL_STRING(ServerKey);
req->Set(ServerKey, serverArray); req->ForceSet(ServerKey, serverArray);
TRI_GET_GLOBAL_STRING(PortTypeKey); TRI_GET_GLOBAL_STRING(PortTypeKey);
req->ForceSet(PortTypeKey, TRI_V8_STD_STRING(info.portType()), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); req->ForceSet(PortTypeKey, TRI_V8_STD_STRING(info.portType()), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
v8::Handle<v8::Object> clientArray = v8::Object::New(isolate); v8::Handle<v8::Object> clientArray = v8::Object::New(isolate);
clientArray->Set(AddressKey, TRI_V8_STD_STRING(info.clientAddress)); clientArray->ForceSet(AddressKey, TRI_V8_STD_STRING(info.clientAddress));
clientArray->Set(PortKey, v8::Number::New(isolate, info.clientPort)); clientArray->ForceSet(PortKey, v8::Number::New(isolate, info.clientPort));
TRI_GET_GLOBAL_STRING(ClientKey); TRI_GET_GLOBAL_STRING(ClientKey);
req->Set(ClientKey, clientArray); req->ForceSet(ClientKey, clientArray);
req->Set(TRI_V8_ASCII_STRING("internals"), v8::External::New(isolate, request)); req->ForceSet(TRI_V8_ASCII_STRING("internals"), v8::External::New(isolate, request));
// copy prefix // copy prefix
string path = request->prefix(); string path = request->prefix();
TRI_GET_GLOBAL_STRING(PrefixKey); TRI_GET_GLOBAL_STRING(PrefixKey);
req->Set(PrefixKey, TRI_V8_STD_STRING(path)); req->ForceSet(PrefixKey, TRI_V8_STD_STRING(path));
// copy header fields // copy header fields
v8::Handle<v8::Object> headerFields = v8::Object::New(isolate); v8::Handle<v8::Object> headerFields = v8::Object::New(isolate);
@ -440,61 +440,61 @@ static v8::Handle<v8::Object> RequestCppToV8 (v8::Isolate* isolate,
map<string, string>::const_iterator iter = headers.begin(); map<string, string>::const_iterator iter = headers.begin();
for (; iter != headers.end(); ++iter) { for (; iter != headers.end(); ++iter) {
headerFields->Set(TRI_V8_STD_STRING(iter->first), headerFields->ForceSet(TRI_V8_STD_STRING(iter->first),
TRI_V8_STD_STRING(iter->second)); TRI_V8_STD_STRING(iter->second));
} }
TRI_GET_GLOBAL_STRING(HeadersKey); TRI_GET_GLOBAL_STRING(HeadersKey);
req->Set(HeadersKey, headerFields); req->ForceSet(HeadersKey, headerFields);
TRI_GET_GLOBAL_STRING(RequestTypeKey); TRI_GET_GLOBAL_STRING(RequestTypeKey);
TRI_GET_GLOBAL_STRING(RequestBodyKey); TRI_GET_GLOBAL_STRING(RequestBodyKey);
// copy request type // copy request type
switch (request->requestType()) { switch (request->requestType()) {
case HttpRequest::HTTP_REQUEST_POST: { case HttpRequest::HTTP_REQUEST_POST: {
TRI_GET_GLOBAL_STRING(PostConstant); TRI_GET_GLOBAL_STRING(PostConstant);
req->Set(RequestTypeKey, PostConstant); req->ForceSet(RequestTypeKey, PostConstant);
req->Set(RequestBodyKey, TRI_V8_PAIR_STRING(request->body(), req->ForceSet(RequestBodyKey, TRI_V8_PAIR_STRING(request->body(),
(int) request->bodySize())); (int) request->bodySize()));
break; break;
} }
case HttpRequest::HTTP_REQUEST_PUT: { case HttpRequest::HTTP_REQUEST_PUT: {
TRI_GET_GLOBAL_STRING(PutConstant); TRI_GET_GLOBAL_STRING(PutConstant);
req->Set(RequestTypeKey, PutConstant); req->ForceSet(RequestTypeKey, PutConstant);
req->Set(RequestBodyKey, TRI_V8_PAIR_STRING(request->body(), req->ForceSet(RequestBodyKey, TRI_V8_PAIR_STRING(request->body(),
(int) request->bodySize())); (int) request->bodySize()));
break; break;
} }
case HttpRequest::HTTP_REQUEST_PATCH: { case HttpRequest::HTTP_REQUEST_PATCH: {
TRI_GET_GLOBAL_STRING(PatchConstant); TRI_GET_GLOBAL_STRING(PatchConstant);
req->Set(RequestTypeKey, PatchConstant); req->ForceSet(RequestTypeKey, PatchConstant);
req->Set(RequestBodyKey, TRI_V8_PAIR_STRING(request->body(), req->ForceSet(RequestBodyKey, TRI_V8_PAIR_STRING(request->body(),
(int) request->bodySize())); (int) request->bodySize()));
break; break;
} }
case HttpRequest::HTTP_REQUEST_OPTIONS: { case HttpRequest::HTTP_REQUEST_OPTIONS: {
TRI_GET_GLOBAL_STRING(OptionsConstant); TRI_GET_GLOBAL_STRING(OptionsConstant);
req->Set(RequestTypeKey, OptionsConstant); req->ForceSet(RequestTypeKey, OptionsConstant);
break; break;
} }
case HttpRequest::HTTP_REQUEST_DELETE: { case HttpRequest::HTTP_REQUEST_DELETE: {
TRI_GET_GLOBAL_STRING(DeleteConstant); TRI_GET_GLOBAL_STRING(DeleteConstant);
req->Set(RequestTypeKey, DeleteConstant); req->ForceSet(RequestTypeKey, DeleteConstant);
break; break;
} }
case HttpRequest::HTTP_REQUEST_HEAD: { case HttpRequest::HTTP_REQUEST_HEAD: {
TRI_GET_GLOBAL_STRING(HeadConstant); TRI_GET_GLOBAL_STRING(HeadConstant);
req->Set(RequestTypeKey, HeadConstant); req->ForceSet(RequestTypeKey, HeadConstant);
break; break;
} }
case HttpRequest::HTTP_REQUEST_GET: { case HttpRequest::HTTP_REQUEST_GET: {
default: default:
TRI_GET_GLOBAL_STRING(GetConstant); TRI_GET_GLOBAL_STRING(GetConstant);
req->Set(RequestTypeKey, GetConstant); req->ForceSet(RequestTypeKey, GetConstant);
break; break;
} }
} }
// copy request parameter // copy request parameter
@ -504,7 +504,7 @@ static v8::Handle<v8::Object> RequestCppToV8 (v8::Isolate* isolate,
for (map<string, string>::iterator i = values.begin(); for (map<string, string>::iterator i = values.begin();
i != values.end(); i != values.end();
++i) { ++i) {
valuesObject->Set(TRI_V8_STD_STRING(i->first), TRI_V8_STD_STRING(i->second)); valuesObject->ForceSet(TRI_V8_STD_STRING(i->first), TRI_V8_STD_STRING(i->second));
} }
// copy request array parameter (a[]=1&a[]=2&...) // copy request array parameter (a[]=1&a[]=2&...)
@ -515,17 +515,17 @@ static v8::Handle<v8::Object> RequestCppToV8 (v8::Isolate* isolate,
string const& k = i->first; string const& k = i->first;
vector<char const*>* v = i->second; vector<char const*>* v = i->second;
v8::Handle<v8::Array> list = v8::Array::New(isolate); v8::Handle<v8::Array> list = v8::Array::New(isolate, static_cast<int>(v->size()));
for (size_t i = 0; i < v->size(); ++i) { for (size_t i = 0; i < v->size(); ++i) {
list->Set((uint32_t) i, TRI_V8_ASCII_STRING(v->at(i))); list->Set((uint32_t) i, TRI_V8_ASCII_STRING(v->at(i)));
} }
valuesObject->Set(TRI_V8_STD_STRING(k), list); valuesObject->ForceSet(TRI_V8_STD_STRING(k), list);
} }
TRI_GET_GLOBAL_STRING(ParametersKey); TRI_GET_GLOBAL_STRING(ParametersKey);
req->Set(ParametersKey, valuesObject); req->ForceSet(ParametersKey, valuesObject);
// copy cookies // copy cookies
v8::Handle<v8::Object> cookiesObject = v8::Object::New(isolate); v8::Handle<v8::Object> cookiesObject = v8::Object::New(isolate);
@ -534,17 +534,17 @@ static v8::Handle<v8::Object> RequestCppToV8 (v8::Isolate* isolate,
iter = cookies.begin(); iter = cookies.begin();
for (; iter != cookies.end(); ++iter) { for (; iter != cookies.end(); ++iter) {
cookiesObject->Set(TRI_V8_STD_STRING(iter->first), cookiesObject->ForceSet(TRI_V8_STD_STRING(iter->first),
TRI_V8_STD_STRING(iter->second)); TRI_V8_STD_STRING(iter->second));
} }
TRI_GET_GLOBAL_STRING(CookiesKey); TRI_GET_GLOBAL_STRING(CookiesKey);
req->Set(CookiesKey, cookiesObject); req->ForceSet(CookiesKey, cookiesObject);
// determine API compatibility version // determine API compatibility version
int32_t compatibility = request->compatibility(); int32_t compatibility = request->compatibility();
TRI_GET_GLOBAL_STRING(CompatibilityKey); TRI_GET_GLOBAL_STRING(CompatibilityKey);
req->Set(CompatibilityKey, v8::Integer::New(isolate, compatibility)); req->ForceSet(CompatibilityKey, v8::Integer::New(isolate, compatibility));
return req; return req;
} }
@ -735,11 +735,11 @@ static TRI_action_result_t ExecuteActionVocbase (TRI_vocbase_t* vocbase,
} }
TRI_GET_GLOBAL_STRING(SuffixKey); TRI_GET_GLOBAL_STRING(SuffixKey);
req->Set(SuffixKey, suffixArray); req->ForceSet(SuffixKey, suffixArray);
// copy full path // copy full path
TRI_GET_GLOBAL_STRING(PathKey); TRI_GET_GLOBAL_STRING(PathKey);
req->Set(PathKey, TRI_V8_STD_STRING(path)); req->ForceSet(PathKey, TRI_V8_STD_STRING(path));
// create the response object // create the response object
v8::Handle<v8::Object> res = v8::Object::New(isolate); v8::Handle<v8::Object> res = v8::Object::New(isolate);

View File

@ -88,28 +88,25 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var AqlHighlightRules = function() { var AqlHighlightRules = function() {
var keywords = ( var keywords = (
"for|return|filter|sort|limit|let|collect|asc|desc|in|into|insert|update|remove|replace|options|with|and|or|not" "for|return|filter|sort|limit|let|collect|asc|desc|if|in|into|insert|update|remove|replace|options|with|and|or|not"
); );
var builtinFunctions = ( var builtinFunctions = (
"(to_bool|to_number|to_string|to_list|is_null|is_bool|is_number|is_string|is_list|is_document|" + "(to_bool|to_number|to_string|to_list|is_null|is_bool|is_number|is_string|is_list|is_document|" +
"concat|concat_separator|char_length|lower|upper|substring|left|right|trim|reverse|contains|" + "concat|concat_separator|char_length|lower|upper|substring|left|right|trim|reverse|contains|" +
"like|floor|ceil|round|abs|sqrt|rand|length|min|max|average|sum|median|variance_population|" + "like|floor|ceil|round|abs|rand|sqrt|length|min|max|average|sum|median|variance_population|" +
"variance_sample|first|last|unique|matches|merge|merge_recursive|has|attributes|values|unset|keep|" + "variance_sample|first|last|unique|matches|merge|merge_recursive|has|attributes|values|unset|keep|" +
"near|within|fulltext|paths|traversal|traversal_tree|edges|not_null|first_list|first_document|" + "near|within|within_rectangle|is_in_polygon|fulltext|paths|traversal|traversal_tree|edges|stddev_sample|stddev_population|" +
"flatten|length|min|max|sum|median|average|variance_sample|variance_population|"+ "slice|nth|position|translate|zip|call|apply|push|append|pop|shift|unshift|remove_value|remove_values|" +
"stddev_sample|stddev_population|unique|slice|reverse|first|last|nth|position|"+ "remove_nth|graph_paths|shortest_path|graph_shortest_path|graph_distance_to|graph_traversal|graph_traversal_tree|graph_edges|" +
"has|attributes|merge|merge_recursive|document|matches|unset|keep|translate|"+ "graph_vertices|neighbors|graph_neighbors|graph_common_neighbors|graph_common_properties|" +
"near|within|fulltext|paths|graph_paths|shortest_path|graph_shortest_path|graph_distance_to|"+ "graph_eccentricity|graph_betweenness|graph_closeness|graph_absolute_eccentricity|" +
"traversal|graph_traversal|traversal_tree|graph_traversal_tree|edges|graph_edges|"+ "graph_absolute_betweenness|graph_absolute_closeness|graph_diameter|graph_radius|date_now|" +
"graph_vertices|neighbors|graph_neighbors|graph_common_neighbors|graph_common_properties|"+ "date_timestamp|date_iso8601|date_dayofweek|date_year|date_month|date_day|date_hour|" +
"graph_eccentricity|graph_betweenness|graph_closeness|graph_absolute_eccentricity|"+ "date_minute|date_second|date_millisecond|fail|passthru|sleep|not_null|" +
"graph_absolute_betweenness|graph_absolute_closeness|graph_diameter|graph_radius|date_now|"+ "first_list|first_document|parse_identifier|skiplist|current_user|current_database|" +
"date_timestamp|date_iso8601|date_dayofweek|date_year|date_month|date_day|date_hour|"+ "collections|document|union|union_distinct|intersection|flatten|" +
"date_minute|date_second|date_millisecond|fail|passthru|sleep|collections|not_null|"+ "ltrim|rtrim|find_first|find_last|split|substitute|assemble|md5|sha1|random_token|AQL_LAST_ENTRY)"
"first_list|first_document|parse_identifier|skiplist|current_user|current_database|"+
"collections|document|stddev_population|stddev_sample|neighbors|union|union_distinct|intersection|"+
"ltrim|rtrim|find_first|find_last|split|substitute|assemble|AQL_LAST_ENTRY)"
); );
var keywordMapper = this.createKeywordMapper({ var keywordMapper = this.createKeywordMapper({

View File

@ -192,7 +192,7 @@ Endpoint* Endpoint::factory (const Endpoint::EndpointType type,
int listenBacklog, int listenBacklog,
bool reuseAddress) { bool reuseAddress) {
if (specification.size() < 7) { if (specification.size() < 7) {
return 0; return nullptr;
} }
if (listenBacklog > 0 && type == ENDPOINT_CLIENT) { if (listenBacklog > 0 && type == ENDPOINT_CLIENT) {
@ -220,7 +220,7 @@ Endpoint* Endpoint::factory (const Endpoint::EndpointType type,
} }
else { else {
// invalid protocol // invalid protocol
return 0; return nullptr;
} }
} }
@ -242,13 +242,13 @@ Endpoint* Endpoint::factory (const Endpoint::EndpointType type,
// no unix socket for windows // no unix socket for windows
else if (StringUtils::isPrefix(domainType, "unix://")) { else if (StringUtils::isPrefix(domainType, "unix://")) {
// unix socket // unix socket
return 0; return nullptr;
} }
#endif #endif
else if (! StringUtils::isPrefix(domainType, "tcp://")) { else if (! StringUtils::isPrefix(domainType, "tcp://")) {
// invalid type // invalid type
return 0; return nullptr;
} }
// tcp/ip or ssl // tcp/ip or ssl
@ -284,7 +284,7 @@ Endpoint* Endpoint::factory (const Endpoint::EndpointType type,
} }
// invalid address specification // invalid address specification
return 0; return nullptr;
} }
// ipv4 // ipv4

View File

@ -93,9 +93,9 @@ EndpointIp::EndpointIp (const Endpoint::EndpointType type,
const std::string& host, const std::string& host,
const uint16_t port) const uint16_t port)
: Endpoint(type, domainType, encryption, specification, listenBacklog), : Endpoint(type, domainType, encryption, specification, listenBacklog),
_reuseAddress(reuseAddress),
_host(host), _host(host),
_port(port) { _port(port),
_reuseAddress(reuseAddress) {
TRI_ASSERT(domainType == DOMAIN_IPV4 || domainType == Endpoint::DOMAIN_IPV6); TRI_ASSERT(domainType == DOMAIN_IPV4 || domainType == Endpoint::DOMAIN_IPV6);
} }
@ -274,7 +274,7 @@ TRI_socket_t EndpointIp::connectSocket (const struct addrinfo* aip,
TRI_socket_t EndpointIp::connect (double connectTimeout, TRI_socket_t EndpointIp::connect (double connectTimeout,
double requestTimeout) { double requestTimeout) {
struct addrinfo* result = 0; struct addrinfo* result = nullptr;
struct addrinfo* aip; struct addrinfo* aip;
struct addrinfo hints; struct addrinfo hints;
int error; int error;
@ -317,7 +317,7 @@ TRI_socket_t EndpointIp::connect (double connectTimeout,
} }
} }
if (result != 0) { if (result != nullptr) {
freeaddrinfo(result); freeaddrinfo(result);
} }
@ -326,7 +326,7 @@ TRI_socket_t EndpointIp::connect (double connectTimeout,
// Try all returned addresses until one works // Try all returned addresses until one works
for (aip = result; aip != NULL; aip = aip->ai_next) { for (aip = result; aip != nullptr; aip = aip->ai_next) {
// try to bind the address info pointer // try to bind the address info pointer
listenSocket = connectSocket(aip, connectTimeout, requestTimeout); listenSocket = connectSocket(aip, connectTimeout, requestTimeout);
if (TRI_isvalidsocket(listenSocket)) { if (TRI_isvalidsocket(listenSocket)) {
@ -343,7 +343,7 @@ TRI_socket_t EndpointIp::connect (double connectTimeout,
#else #else
TRI_socket_t EndpointIp::connect (double connectTimeout, double requestTimeout) { TRI_socket_t EndpointIp::connect (double connectTimeout, double requestTimeout) {
struct addrinfo* result = 0; struct addrinfo* result = nullptr;
struct addrinfo* aip; struct addrinfo* aip;
struct addrinfo hints; struct addrinfo hints;
int error; int error;
@ -367,7 +367,7 @@ TRI_socket_t EndpointIp::connect (double connectTimeout, double requestTimeout)
if (error != 0) { if (error != 0) {
_errorMessage = std::string("getaddrinfo for host '") + _host + std::string("': ") + gai_strerror(error); _errorMessage = std::string("getaddrinfo for host '") + _host + std::string("': ") + gai_strerror(error);
if (result != 0) { if (result != nullptr) {
freeaddrinfo(result); freeaddrinfo(result);
} }
return listenSocket; return listenSocket;
@ -375,7 +375,7 @@ TRI_socket_t EndpointIp::connect (double connectTimeout, double requestTimeout)
// Try all returned addresses until one works // Try all returned addresses until one works
for (aip = result; aip != NULL; aip = aip->ai_next) { for (aip = result; aip != nullptr; aip = aip->ai_next) {
// try to bind the address info pointer // try to bind the address info pointer
listenSocket = connectSocket(aip, connectTimeout, requestTimeout); listenSocket = connectSocket(aip, connectTimeout, requestTimeout);
if (TRI_isvalidsocket(listenSocket)) { if (TRI_isvalidsocket(listenSocket)) {

View File

@ -145,23 +145,24 @@ namespace triagens {
private: private:
////////////////////////////////////////////////////////////////////////////////
/// @brief whether or not to reuse the address
////////////////////////////////////////////////////////////////////////////////
bool _reuseAddress;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief host name / address (IPv4 or IPv6) /// @brief host name / address (IPv4 or IPv6)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
std::string _host; std::string const _host;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief port number /// @brief port number
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
uint16_t _port; uint16_t _port;
////////////////////////////////////////////////////////////////////////////////
/// @brief whether or not to reuse the address
////////////////////////////////////////////////////////////////////////////////
bool _reuseAddress;
}; };
} }

View File

@ -604,7 +604,7 @@ static void JS_Download (const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Handle<v8::Array> props = v8Headers->GetPropertyNames(); v8::Handle<v8::Array> props = v8Headers->GetPropertyNames();
for (uint32_t i = 0; i < props->Length(); i++) { for (uint32_t i = 0; i < props->Length(); i++) {
v8::Handle<v8::Value> key = props->Get(v8::Integer::New(isolate, i)); v8::Handle<v8::Value> key = props->Get(i);
headerFields[TRI_ObjectToString(key)] = TRI_ObjectToString(v8Headers->Get(key)); headerFields[TRI_ObjectToString(key)] = TRI_ObjectToString(v8Headers->Get(key));
} }
} }
@ -657,7 +657,7 @@ static void JS_Download (const v8::FunctionCallbackInfo<v8::Value>& args) {
outfile = TRI_ObjectToString(args[3]); outfile = TRI_ObjectToString(args[3]);
} }
if (outfile == "") { if (outfile.empty()) {
TRI_V8_THROW_EXCEPTION_MESSAGE(TRI_ERROR_BAD_PARAMETER, "invalid value provided for outfile"); TRI_V8_THROW_EXCEPTION_MESSAGE(TRI_ERROR_BAD_PARAMETER, "invalid value provided for outfile");
} }
@ -716,6 +716,7 @@ static void JS_Download (const v8::FunctionCallbackInfo<v8::Value>& args) {
url.c_str()); url.c_str());
Endpoint* ep = Endpoint::clientFactory(endpoint); Endpoint* ep = Endpoint::clientFactory(endpoint);
if (ep == nullptr) { if (ep == nullptr) {
TRI_V8_THROW_EXCEPTION_MESSAGE(TRI_ERROR_BAD_PARAMETER, "invalid URL"); TRI_V8_THROW_EXCEPTION_MESSAGE(TRI_ERROR_BAD_PARAMETER, "invalid URL");
} }
@ -739,21 +740,21 @@ static void JS_Download (const v8::FunctionCallbackInfo<v8::Value>& args) {
// send the actual request // send the actual request
SimpleHttpResult* response = client->request(method, SimpleHttpResult* response = client->request(method,
relative, relative,
(body.size() > 0 ? body.c_str() : 0), (body.size() > 0 ? body.c_str() : nullptr),
body.size(), body.size(),
headerFields); headerFields);
int returnCode; int returnCode = 500; // set a default
string returnMessage; string returnMessage;
if (! response || ! response->isComplete()) { if (response == nullptr || ! response->isComplete()) {
// save error message // save error message
returnMessage = client->getErrorMessage(); returnMessage = client->getErrorMessage();
returnCode = 500; returnCode = 500;
delete client; delete client;
if (response && response->getHttpReturnCode() > 0) { if (response != nullptr && response->getHttpReturnCode() > 0) {
returnCode = response->getHttpReturnCode(); returnCode = response->getHttpReturnCode();
} }
} }
@ -771,7 +772,7 @@ static void JS_Download (const v8::FunctionCallbackInfo<v8::Value>& args) {
delete response; delete response;
delete connection; delete connection;
connection = 0; connection = nullptr;
delete ep; delete ep;
if (! found) { if (! found) {