diff --git a/src/node.cc b/src/node.cc index b521116e64..173bcaa61b 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2013,6 +2013,19 @@ static Handle EnvEnumerator(const AccessorInfo& info) { } +static Handle GetFeatures() { + HandleScope scope; + + Local obj = Object::New(); + obj->Set(String::NewSymbol("uv"), Boolean::New(use_uv)); + obj->Set(String::NewSymbol("ipv6"), True()); // TODO ping libuv + obj->Set(String::NewSymbol("tls"), + Boolean::New(get_builtin_module("crypto") != NULL)); + + return scope.Close(obj); +} + + Handle SetupProcessObject(int argc, char *argv[]) { HandleScope scope; @@ -2102,7 +2115,7 @@ Handle SetupProcessObject(int argc, char *argv[]) { process->Set(String::NewSymbol("ENV"), ENV); process->Set(String::NewSymbol("pid"), Integer::New(getpid())); - process->Set(String::NewSymbol("useUV"), use_uv ? True() : False()); + process->Set(String::NewSymbol("features"), GetFeatures()); // -e, --eval if (eval_string) { diff --git a/src/node.js b/src/node.js index b80f72891e..cecc240e42 100644 --- a/src/node.js +++ b/src/node.js @@ -31,7 +31,7 @@ function startup() { - if (process.env.NODE_USE_UV == '1') process.useUV = true; + if (process.env.NODE_USE_UV == '1') process.features.uv = true; EventEmitter = NativeModule.require('events').EventEmitter; process.__proto__ = EventEmitter.prototype; @@ -389,13 +389,13 @@ function translateId(id) { switch (id) { case 'net': - return process.useUV ? 'net_uv' : 'net_legacy'; + return process.features.uv ? 'net_uv' : 'net_legacy'; case 'timers': - return process.useUV ? 'timers_uv' : 'timers_legacy'; + return process.features.uv ? 'timers_uv' : 'timers_legacy'; case 'dns': - return process.useUV ? 'dns_uv' : 'dns_legacy'; + return process.features.uv ? 'dns_uv' : 'dns_legacy'; default: return id; diff --git a/test/internet/test-dns.js b/test/internet/test-dns.js index 746c206166..f738ab6a06 100644 --- a/test/internet/test-dns.js +++ b/test/internet/test-dns.js @@ -25,7 +25,7 @@ var assert = require('assert'); isIP = net.isIP, isIPv4 = net.isIPv4, isIPv6 = net.isIPv6, - uv = process.useUV; + uv = process.features.uv; var expected = 0, completed = 0,