mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:arangodb/arangodb into devel
This commit is contained in:
commit
b64f515f61
|
@ -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.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.
|
||||
* 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`.
|
||||
* 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
|
||||
|
|
10
Makefile.am
10
Makefile.am
|
@ -249,6 +249,9 @@ pkgdataSERVERdir = $(datadir)/arangodb
|
|||
pkgdataCLIENTdir = $(datadir)/arangodb
|
||||
pkgdataNODEdir = $(datadir)/arangodb
|
||||
pkgdataAPPSdir = $(datadir)/arangodb
|
||||
pkgdataAPPSADMINdir = $(datadir)/arangodb
|
||||
pkgdataAPPSAPIdir = $(datadir)/arangodb
|
||||
pkgdataAPPSSYSTEMdir = $(datadir)/arangodb
|
||||
pkgdataMRUBYdir = $(datadir)/arangodb
|
||||
|
||||
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_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_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
|
||||
|
||||
|
|
|
@ -383,10 +383,10 @@ static v8::Handle<v8::Object> RequestCppToV8 (v8::Isolate* isolate,
|
|||
|
||||
TRI_GET_GLOBAL_STRING(UserKey);
|
||||
if (user.empty()) {
|
||||
req->Set(UserKey, v8::Null(isolate));
|
||||
req->ForceSet(UserKey, v8::Null(isolate));
|
||||
}
|
||||
else {
|
||||
req->Set(UserKey, TRI_V8_STD_STRING(user));
|
||||
req->ForceSet(UserKey, TRI_V8_STD_STRING(user));
|
||||
}
|
||||
|
||||
// create database attribute
|
||||
|
@ -394,44 +394,44 @@ static v8::Handle<v8::Object> RequestCppToV8 (v8::Isolate* isolate,
|
|||
TRI_ASSERT(! database.empty());
|
||||
|
||||
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
|
||||
string const& fullUrl = request->fullUrl();
|
||||
TRI_GET_GLOBAL_STRING(UrlKey);
|
||||
req->Set(UrlKey, TRI_V8_STD_STRING(fullUrl));
|
||||
req->ForceSet(UrlKey, TRI_V8_STD_STRING(fullUrl));
|
||||
|
||||
// set the protocol
|
||||
string const& protocol = request->protocol();
|
||||
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
|
||||
const ConnectionInfo& info = request->connectionInfo();
|
||||
|
||||
v8::Handle<v8::Object> serverArray = v8::Object::New(isolate);
|
||||
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);
|
||||
serverArray->Set(PortKey, v8::Number::New(isolate, info.serverPort));
|
||||
serverArray->ForceSet(PortKey, v8::Number::New(isolate, info.serverPort));
|
||||
TRI_GET_GLOBAL_STRING(ServerKey);
|
||||
req->Set(ServerKey, serverArray);
|
||||
req->ForceSet(ServerKey, serverArray);
|
||||
|
||||
TRI_GET_GLOBAL_STRING(PortTypeKey);
|
||||
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);
|
||||
clientArray->Set(AddressKey, TRI_V8_STD_STRING(info.clientAddress));
|
||||
clientArray->Set(PortKey, v8::Number::New(isolate, info.clientPort));
|
||||
clientArray->ForceSet(AddressKey, TRI_V8_STD_STRING(info.clientAddress));
|
||||
clientArray->ForceSet(PortKey, v8::Number::New(isolate, info.clientPort));
|
||||
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
|
||||
string path = request->prefix();
|
||||
TRI_GET_GLOBAL_STRING(PrefixKey);
|
||||
req->Set(PrefixKey, TRI_V8_STD_STRING(path));
|
||||
req->ForceSet(PrefixKey, TRI_V8_STD_STRING(path));
|
||||
|
||||
// copy header fields
|
||||
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();
|
||||
|
||||
for (; iter != headers.end(); ++iter) {
|
||||
headerFields->Set(TRI_V8_STD_STRING(iter->first),
|
||||
TRI_V8_STD_STRING(iter->second));
|
||||
headerFields->ForceSet(TRI_V8_STD_STRING(iter->first),
|
||||
TRI_V8_STD_STRING(iter->second));
|
||||
}
|
||||
|
||||
TRI_GET_GLOBAL_STRING(HeadersKey);
|
||||
req->Set(HeadersKey, headerFields);
|
||||
req->ForceSet(HeadersKey, headerFields);
|
||||
TRI_GET_GLOBAL_STRING(RequestTypeKey);
|
||||
TRI_GET_GLOBAL_STRING(RequestBodyKey);
|
||||
|
||||
// copy request type
|
||||
switch (request->requestType()) {
|
||||
case HttpRequest::HTTP_REQUEST_POST: {
|
||||
TRI_GET_GLOBAL_STRING(PostConstant);
|
||||
req->Set(RequestTypeKey, PostConstant);
|
||||
req->Set(RequestBodyKey, TRI_V8_PAIR_STRING(request->body(),
|
||||
(int) request->bodySize()));
|
||||
break;
|
||||
}
|
||||
case HttpRequest::HTTP_REQUEST_POST: {
|
||||
TRI_GET_GLOBAL_STRING(PostConstant);
|
||||
req->ForceSet(RequestTypeKey, PostConstant);
|
||||
req->ForceSet(RequestBodyKey, TRI_V8_PAIR_STRING(request->body(),
|
||||
(int) request->bodySize()));
|
||||
break;
|
||||
}
|
||||
|
||||
case HttpRequest::HTTP_REQUEST_PUT: {
|
||||
TRI_GET_GLOBAL_STRING(PutConstant);
|
||||
req->Set(RequestTypeKey, PutConstant);
|
||||
req->Set(RequestBodyKey, TRI_V8_PAIR_STRING(request->body(),
|
||||
(int) request->bodySize()));
|
||||
break;
|
||||
}
|
||||
case HttpRequest::HTTP_REQUEST_PUT: {
|
||||
TRI_GET_GLOBAL_STRING(PutConstant);
|
||||
req->ForceSet(RequestTypeKey, PutConstant);
|
||||
req->ForceSet(RequestBodyKey, TRI_V8_PAIR_STRING(request->body(),
|
||||
(int) request->bodySize()));
|
||||
break;
|
||||
}
|
||||
|
||||
case HttpRequest::HTTP_REQUEST_PATCH: {
|
||||
TRI_GET_GLOBAL_STRING(PatchConstant);
|
||||
req->Set(RequestTypeKey, PatchConstant);
|
||||
req->Set(RequestBodyKey, TRI_V8_PAIR_STRING(request->body(),
|
||||
(int) request->bodySize()));
|
||||
break;
|
||||
}
|
||||
case HttpRequest::HTTP_REQUEST_OPTIONS: {
|
||||
TRI_GET_GLOBAL_STRING(OptionsConstant);
|
||||
req->Set(RequestTypeKey, OptionsConstant);
|
||||
break;
|
||||
}
|
||||
case HttpRequest::HTTP_REQUEST_DELETE: {
|
||||
TRI_GET_GLOBAL_STRING(DeleteConstant);
|
||||
req->Set(RequestTypeKey, DeleteConstant);
|
||||
break;
|
||||
}
|
||||
case HttpRequest::HTTP_REQUEST_HEAD: {
|
||||
TRI_GET_GLOBAL_STRING(HeadConstant);
|
||||
req->Set(RequestTypeKey, HeadConstant);
|
||||
break;
|
||||
}
|
||||
case HttpRequest::HTTP_REQUEST_GET: {
|
||||
default:
|
||||
TRI_GET_GLOBAL_STRING(GetConstant);
|
||||
req->Set(RequestTypeKey, GetConstant);
|
||||
break;
|
||||
}
|
||||
case HttpRequest::HTTP_REQUEST_PATCH: {
|
||||
TRI_GET_GLOBAL_STRING(PatchConstant);
|
||||
req->ForceSet(RequestTypeKey, PatchConstant);
|
||||
req->ForceSet(RequestBodyKey, TRI_V8_PAIR_STRING(request->body(),
|
||||
(int) request->bodySize()));
|
||||
break;
|
||||
}
|
||||
case HttpRequest::HTTP_REQUEST_OPTIONS: {
|
||||
TRI_GET_GLOBAL_STRING(OptionsConstant);
|
||||
req->ForceSet(RequestTypeKey, OptionsConstant);
|
||||
break;
|
||||
}
|
||||
case HttpRequest::HTTP_REQUEST_DELETE: {
|
||||
TRI_GET_GLOBAL_STRING(DeleteConstant);
|
||||
req->ForceSet(RequestTypeKey, DeleteConstant);
|
||||
break;
|
||||
}
|
||||
case HttpRequest::HTTP_REQUEST_HEAD: {
|
||||
TRI_GET_GLOBAL_STRING(HeadConstant);
|
||||
req->ForceSet(RequestTypeKey, HeadConstant);
|
||||
break;
|
||||
}
|
||||
case HttpRequest::HTTP_REQUEST_GET: {
|
||||
default:
|
||||
TRI_GET_GLOBAL_STRING(GetConstant);
|
||||
req->ForceSet(RequestTypeKey, GetConstant);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// copy request parameter
|
||||
|
@ -504,7 +504,7 @@ static v8::Handle<v8::Object> RequestCppToV8 (v8::Isolate* isolate,
|
|||
for (map<string, string>::iterator i = values.begin();
|
||||
i != values.end();
|
||||
++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&...)
|
||||
|
@ -515,17 +515,17 @@ static v8::Handle<v8::Object> RequestCppToV8 (v8::Isolate* isolate,
|
|||
string const& k = i->first;
|
||||
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) {
|
||||
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);
|
||||
req->Set(ParametersKey, valuesObject);
|
||||
req->ForceSet(ParametersKey, valuesObject);
|
||||
|
||||
// copy cookies
|
||||
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();
|
||||
|
||||
for (; iter != cookies.end(); ++iter) {
|
||||
cookiesObject->Set(TRI_V8_STD_STRING(iter->first),
|
||||
TRI_V8_STD_STRING(iter->second));
|
||||
cookiesObject->ForceSet(TRI_V8_STD_STRING(iter->first),
|
||||
TRI_V8_STD_STRING(iter->second));
|
||||
}
|
||||
|
||||
TRI_GET_GLOBAL_STRING(CookiesKey);
|
||||
req->Set(CookiesKey, cookiesObject);
|
||||
req->ForceSet(CookiesKey, cookiesObject);
|
||||
|
||||
// determine API compatibility version
|
||||
int32_t compatibility = request->compatibility();
|
||||
TRI_GET_GLOBAL_STRING(CompatibilityKey);
|
||||
req->Set(CompatibilityKey, v8::Integer::New(isolate, compatibility));
|
||||
req->ForceSet(CompatibilityKey, v8::Integer::New(isolate, compatibility));
|
||||
|
||||
return req;
|
||||
}
|
||||
|
@ -735,11 +735,11 @@ static TRI_action_result_t ExecuteActionVocbase (TRI_vocbase_t* vocbase,
|
|||
}
|
||||
|
||||
TRI_GET_GLOBAL_STRING(SuffixKey);
|
||||
req->Set(SuffixKey, suffixArray);
|
||||
req->ForceSet(SuffixKey, suffixArray);
|
||||
|
||||
// copy full path
|
||||
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
|
||||
v8::Handle<v8::Object> res = v8::Object::New(isolate);
|
||||
|
|
|
@ -88,28 +88,25 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
|||
var AqlHighlightRules = function() {
|
||||
|
||||
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 = (
|
||||
"(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|" +
|
||||
"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|" +
|
||||
"near|within|fulltext|paths|traversal|traversal_tree|edges|not_null|first_list|first_document|" +
|
||||
"flatten|length|min|max|sum|median|average|variance_sample|variance_population|"+
|
||||
"stddev_sample|stddev_population|unique|slice|reverse|first|last|nth|position|"+
|
||||
"has|attributes|merge|merge_recursive|document|matches|unset|keep|translate|"+
|
||||
"near|within|fulltext|paths|graph_paths|shortest_path|graph_shortest_path|graph_distance_to|"+
|
||||
"traversal|graph_traversal|traversal_tree|graph_traversal_tree|edges|graph_edges|"+
|
||||
"graph_vertices|neighbors|graph_neighbors|graph_common_neighbors|graph_common_properties|"+
|
||||
"graph_eccentricity|graph_betweenness|graph_closeness|graph_absolute_eccentricity|"+
|
||||
"graph_absolute_betweenness|graph_absolute_closeness|graph_diameter|graph_radius|date_now|"+
|
||||
"date_timestamp|date_iso8601|date_dayofweek|date_year|date_month|date_day|date_hour|"+
|
||||
"date_minute|date_second|date_millisecond|fail|passthru|sleep|collections|not_null|"+
|
||||
"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)"
|
||||
"near|within|within_rectangle|is_in_polygon|fulltext|paths|traversal|traversal_tree|edges|stddev_sample|stddev_population|" +
|
||||
"slice|nth|position|translate|zip|call|apply|push|append|pop|shift|unshift|remove_value|remove_values|" +
|
||||
"remove_nth|graph_paths|shortest_path|graph_shortest_path|graph_distance_to|graph_traversal|graph_traversal_tree|graph_edges|" +
|
||||
"graph_vertices|neighbors|graph_neighbors|graph_common_neighbors|graph_common_properties|" +
|
||||
"graph_eccentricity|graph_betweenness|graph_closeness|graph_absolute_eccentricity|" +
|
||||
"graph_absolute_betweenness|graph_absolute_closeness|graph_diameter|graph_radius|date_now|" +
|
||||
"date_timestamp|date_iso8601|date_dayofweek|date_year|date_month|date_day|date_hour|" +
|
||||
"date_minute|date_second|date_millisecond|fail|passthru|sleep|not_null|" +
|
||||
"first_list|first_document|parse_identifier|skiplist|current_user|current_database|" +
|
||||
"collections|document|union|union_distinct|intersection|flatten|" +
|
||||
"ltrim|rtrim|find_first|find_last|split|substitute|assemble|md5|sha1|random_token|AQL_LAST_ENTRY)"
|
||||
);
|
||||
|
||||
var keywordMapper = this.createKeywordMapper({
|
||||
|
|
|
@ -192,7 +192,7 @@ Endpoint* Endpoint::factory (const Endpoint::EndpointType type,
|
|||
int listenBacklog,
|
||||
bool reuseAddress) {
|
||||
if (specification.size() < 7) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (listenBacklog > 0 && type == ENDPOINT_CLIENT) {
|
||||
|
@ -220,7 +220,7 @@ Endpoint* Endpoint::factory (const Endpoint::EndpointType type,
|
|||
}
|
||||
else {
|
||||
// invalid protocol
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,13 +242,13 @@ Endpoint* Endpoint::factory (const Endpoint::EndpointType type,
|
|||
// no unix socket for windows
|
||||
else if (StringUtils::isPrefix(domainType, "unix://")) {
|
||||
// unix socket
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
else if (! StringUtils::isPrefix(domainType, "tcp://")) {
|
||||
// invalid type
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// tcp/ip or ssl
|
||||
|
@ -284,7 +284,7 @@ Endpoint* Endpoint::factory (const Endpoint::EndpointType type,
|
|||
}
|
||||
|
||||
// invalid address specification
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ipv4
|
||||
|
|
|
@ -93,9 +93,9 @@ EndpointIp::EndpointIp (const Endpoint::EndpointType type,
|
|||
const std::string& host,
|
||||
const uint16_t port)
|
||||
: Endpoint(type, domainType, encryption, specification, listenBacklog),
|
||||
_reuseAddress(reuseAddress),
|
||||
_host(host),
|
||||
_port(port) {
|
||||
_port(port),
|
||||
_reuseAddress(reuseAddress) {
|
||||
|
||||
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,
|
||||
double requestTimeout) {
|
||||
struct addrinfo* result = 0;
|
||||
struct addrinfo* result = nullptr;
|
||||
struct addrinfo* aip;
|
||||
struct addrinfo hints;
|
||||
int error;
|
||||
|
@ -317,7 +317,7 @@ TRI_socket_t EndpointIp::connect (double connectTimeout,
|
|||
}
|
||||
}
|
||||
|
||||
if (result != 0) {
|
||||
if (result != nullptr) {
|
||||
freeaddrinfo(result);
|
||||
}
|
||||
|
||||
|
@ -326,7 +326,7 @@ TRI_socket_t EndpointIp::connect (double connectTimeout,
|
|||
|
||||
|
||||
// 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
|
||||
listenSocket = connectSocket(aip, connectTimeout, requestTimeout);
|
||||
if (TRI_isvalidsocket(listenSocket)) {
|
||||
|
@ -343,7 +343,7 @@ TRI_socket_t EndpointIp::connect (double connectTimeout,
|
|||
#else
|
||||
|
||||
TRI_socket_t EndpointIp::connect (double connectTimeout, double requestTimeout) {
|
||||
struct addrinfo* result = 0;
|
||||
struct addrinfo* result = nullptr;
|
||||
struct addrinfo* aip;
|
||||
struct addrinfo hints;
|
||||
int error;
|
||||
|
@ -367,7 +367,7 @@ TRI_socket_t EndpointIp::connect (double connectTimeout, double requestTimeout)
|
|||
if (error != 0) {
|
||||
_errorMessage = std::string("getaddrinfo for host '") + _host + std::string("': ") + gai_strerror(error);
|
||||
|
||||
if (result != 0) {
|
||||
if (result != nullptr) {
|
||||
freeaddrinfo(result);
|
||||
}
|
||||
return listenSocket;
|
||||
|
@ -375,7 +375,7 @@ TRI_socket_t EndpointIp::connect (double connectTimeout, double requestTimeout)
|
|||
|
||||
|
||||
// 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
|
||||
listenSocket = connectSocket(aip, connectTimeout, requestTimeout);
|
||||
if (TRI_isvalidsocket(listenSocket)) {
|
||||
|
|
|
@ -145,23 +145,24 @@ namespace triagens {
|
|||
|
||||
private:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief whether or not to reuse the address
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool _reuseAddress;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief host name / address (IPv4 or IPv6)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::string _host;
|
||||
std::string const _host;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief port number
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
uint16_t _port;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief whether or not to reuse the address
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool _reuseAddress;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -604,7 +604,7 @@ static void JS_Download (const v8::FunctionCallbackInfo<v8::Value>& args) {
|
|||
v8::Handle<v8::Array> props = v8Headers->GetPropertyNames();
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
@ -657,7 +657,7 @@ static void JS_Download (const v8::FunctionCallbackInfo<v8::Value>& args) {
|
|||
outfile = TRI_ObjectToString(args[3]);
|
||||
}
|
||||
|
||||
if (outfile == "") {
|
||||
if (outfile.empty()) {
|
||||
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());
|
||||
|
||||
Endpoint* ep = Endpoint::clientFactory(endpoint);
|
||||
|
||||
if (ep == nullptr) {
|
||||
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
|
||||
SimpleHttpResult* response = client->request(method,
|
||||
relative,
|
||||
(body.size() > 0 ? body.c_str() : 0),
|
||||
(body.size() > 0 ? body.c_str() : nullptr),
|
||||
body.size(),
|
||||
headerFields);
|
||||
|
||||
int returnCode;
|
||||
int returnCode = 500; // set a default
|
||||
string returnMessage;
|
||||
|
||||
if (! response || ! response->isComplete()) {
|
||||
if (response == nullptr || ! response->isComplete()) {
|
||||
// save error message
|
||||
returnMessage = client->getErrorMessage();
|
||||
returnCode = 500;
|
||||
|
||||
delete client;
|
||||
|
||||
if (response && response->getHttpReturnCode() > 0) {
|
||||
if (response != nullptr && response->getHttpReturnCode() > 0) {
|
||||
returnCode = response->getHttpReturnCode();
|
||||
}
|
||||
}
|
||||
|
@ -771,7 +772,7 @@ static void JS_Download (const v8::FunctionCallbackInfo<v8::Value>& args) {
|
|||
|
||||
delete response;
|
||||
delete connection;
|
||||
connection = 0;
|
||||
connection = nullptr;
|
||||
delete ep;
|
||||
|
||||
if (! found) {
|
||||
|
|
Loading…
Reference in New Issue