Clarified address regex

pull/2901/head
murgatroid99 9 years ago
parent 4fdb2d5c80
commit e804777708
  1. 4
      src/node/src/client.js

@ -548,8 +548,8 @@ exports.makeClientConstructor = function(methods, serviceName) {
} }
options['grpc.primary_user_agent'] = 'grpc-node/' + version; options['grpc.primary_user_agent'] = 'grpc-node/' + version;
this.channel = new grpc.Channel(address, credentials, options); this.channel = new grpc.Channel(address, credentials, options);
// Extract the DNS name from the address string // Remove the optional DNS scheme, trailing port, and trailing backslash
address = address.replace(/(\w+:\/\/+)?([^:]+)(:\d+)?\/?$/, '$2'); address = address.replace(/^(dns:\/{3})?([^:\/]+)(:\d+)?\/?$/, '$2');
this.server_address = address; this.server_address = address;
this.auth_uri = 'https://' + this.server_address + '/' + serviceName; this.auth_uri = 'https://' + this.server_address + '/' + serviceName;
this.updateMetadata = updateMetadata; this.updateMetadata = updateMetadata;

Loading…
Cancel
Save