Permalink
Browse files

Simplifying host parsing code.

  • Loading branch information...
1 parent 0c7d0bb commit fca33188423a19b08ed6f306309ba6bf89d833f3 Andre Rodrigues committed Oct 14, 2012
Showing with 8 additions and 9 deletions.
  1. +7 −7 lib/services/core/storageserviceclient.js
  2. +1 −2 lib/services/serviceBus/servicebusservice.js
@@ -100,16 +100,16 @@ StorageServiceClient.getStorageSettings = function (storageAccountOrConnectionSt
if (host) {
var parsedHost = ServiceClient._parseHost(host);
- if (parsedHost.hostname + ':' + parsedHost.port === ServiceClient.DEVSTORE_BLOB_HOST ||
- parsedHost.hostname + ':' + parsedHost.port === ServiceClient.DEVSTORE_TABLE_HOST ||
- parsedHost.hostname + ':' + parsedHost.port === ServiceClient.DEVSTORE_QUEUE_HOST) {
-
+ var parsedHostUrl = url.format(parsedHost);
+ if (parsedHostUrl === url.format(ServiceClient._parseHost(ServiceClient.DEVSTORE_BLOB_HOST)) ||
+ parsedHostUrl === url.format(ServiceClient._parseHost(ServiceClient.DEVSTORE_TABLE_HOST)) ||
+ parsedHostUrl === url.format(ServiceClient._parseHost(ServiceClient.DEVSTORE_QUEUE_HOST))) {
usePathStyleUri = true;
}
- blobendpoint = url.format({ protocol: parsedHost.protocol, port: parsedHost.port, hostname: parsedHost.hostname });
- tableendpoint = url.format({ protocol: parsedHost.protocol, port: parsedHost.port, hostname: parsedHost.hostname });
- queueendpoint = url.format({ protocol: parsedHost.protocol, port: parsedHost.port, hostname: parsedHost.hostname });
+ blobendpoint = url.format(parsedHostUrl);
+ tableendpoint = url.format(parsedHostUrl);
+ queueendpoint = url.format(parsedHostUrl);
}
var settings = {
@@ -87,8 +87,7 @@ function ServiceBusService(namespaceOrConnectionString, accessKey, issuer, acsNa
var stsendpoint = url.format({ protocol: 'https:', port: 443, hostname: acsNamespace + '.' + ServiceClient.CLOUD_ACCESS_CONTROL_HOST });
if (host) {
- var parsedHost = ServiceClient._parseHost(host);
- endpoint = url.format({ protocol: parsedHost.protocol, port: parsedHost.port, hostname: parsedHost.hostname });
+ endpoint = url.format(ServiceClient._parseHost(host));
}
var settings = {

0 comments on commit fca3318

Please sign in to comment.