aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-02-25 10:40:52 -0800
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-02-25 10:40:52 -0800
commit009c22e4315c033f7a275e0604457963a65ff0fb (patch)
tree05fef8a87c957987c2d8496d5ba0cbe7eb75dc92
parentc753c19b79518399fb6fb7ffdeb0e82e50751789 (diff)
parent3061606fdec09ab74d56a865ea8b3bb847f94b77 (diff)
Merge pull request #792 from murgatroid99/node_interop_tls_fix
Fixed TLS host resolution problems
-rw-r--r--src/node/ext/channel.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/node/ext/channel.cc b/src/node/ext/channel.cc
index 6c7a89e596..bc9461d7df 100644
--- a/src/node/ext/channel.cc
+++ b/src/node/ext/channel.cc
@@ -103,11 +103,15 @@ NAN_METHOD(Channel::New) {
grpc_channel *wrapped_channel;
// Owned by the Channel object
NanUtf8String *host = new NanUtf8String(args[0]);
+ NanUtf8String *host_override = NULL;
if (args[1]->IsUndefined()) {
wrapped_channel = grpc_channel_create(**host, NULL);
} else if (args[1]->IsObject()) {
grpc_credentials *creds = NULL;
Handle<Object> args_hash(args[1]->ToObject()->Clone());
+ if (args_hash->HasOwnProperty(NanNew(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG))) {
+ host_override = new NanUtf8String(args_hash->Get(NanNew(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG)));
+ }
if (args_hash->HasOwnProperty(NanNew("credentials"))) {
Handle<Value> creds_value = args_hash->Get(NanNew("credentials"));
if (!Credentials::HasInstance(creds_value)) {
@@ -155,7 +159,12 @@ NAN_METHOD(Channel::New) {
} else {
return NanThrowTypeError("Channel expects a string and an object");
}
- Channel *channel = new Channel(wrapped_channel, host);
+ Channel *channel;
+ if (host_override == NULL) {
+ channel = new Channel(wrapped_channel, host);
+ } else {
+ channel = new Channel(wrapped_channel, host_override);
+ }
channel->Wrap(args.This());
NanReturnValue(args.This());
} else {