SSL_get0_next_proto_negotiated(ss->ssl_, &npn_proto, &npn_proto_len);
if (!npn_proto) {
- return False();
+ return False(node_isolate);
}
- return String::New((const char*) npn_proto, npn_proto_len);
+ return scope.Close(String::New(reinterpret_cast<const char*>(npn_proto),
+ npn_proto_len));
} else {
return ss->selectedNPNProto_;
}
}
static Handle<Value> GetHostname(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
- char s[255];
- int r = gethostname(s, 255);
+ char buf[MAXHOSTNAMELEN + 1];
- if (r < 0) {
+ if (gethostname(buf, sizeof(buf))) {
#ifdef __POSIX__
return ThrowException(ErrnoException(errno, "gethostname"));
#else // __MINGW32__
}
static Handle<Value> GetOSType(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
#ifdef __POSIX__
- char type[256];
struct utsname info;
-
- uname(&info);
- strncpy(type, info.sysname, strlen(info.sysname));
- type[strlen(info.sysname)] = 0;
-
- return scope.Close(String::New(type));
+ if (uname(&info)) {
+ return ThrowException(ErrnoException(errno, "uname"));
+ }
+ return scope.Close(String::New(info.sysname));
#else // __MINGW32__
return scope.Close(String::New("Windows_NT"));
#endif