Permalink
Browse files

Removing gethostname

  • Loading branch information...
Andre Rodrigues
Andre Rodrigues committed Oct 12, 2012
1 parent 8f30401 commit 865bcc476b823e6c295fff48a6df1d13a3a9a63b
@@ -2176,7 +2176,7 @@ BlobService.prototype.generateSharedAccessSignature = function (container, blob,
var resourceName = createResourceName(container, blob);
var signedQueryString = this.sharedAccessSignatureCredentials.generateSignedQueryString(resourceName, {}, resourceType, sharedAccessPolicy);
- var baseUrl = this.protocol + this._getHostname() + ':' + this.port;
+ var baseUrl = this.protocol + this.host + ':' + this.port;
var path = this._getPath('/' + resourceName);
return {
@@ -2203,7 +2203,7 @@ BlobService.prototype.getBlobUrl = function (container, blob) {
var resourceName = createResourceName(container, blob);
- var baseUrl = this.protocol + this._getHostname() + ':' + this.port;
+ var baseUrl = this.protocol + this.host + ':' + this.port;
var path = this._getPath('/' + resourceName);
return {
@@ -69,7 +69,7 @@ ServiceBusServiceClient.prototype._buildRequestOptions = function (webResource,
}
webResource.addOptionalHeader(HeaderConstants.ACCEPT_CHARSET_HEADER, 'UTF-8');
- webResource.addOptionalHeader(HeaderConstants.HOST_HEADER, this._getHostname() + ':' + this.port);
+ webResource.addOptionalHeader(HeaderConstants.HOST_HEADER, this.host + ':' + this.port);
// Sets the request url in the web resource.
this._setRequestUrl(webResource);
@@ -90,7 +90,7 @@ ServiceBusServiceClient.prototype._buildRequestOptions = function (webResource,
requestOptions = {
url: url.format({
protocol: self._isHttps() ? 'https:' : 'http:',
- hostname: self._getHostname(),
+ hostname: self.host,
port: self.port,
pathname: webResource.path + webResource.getQueryString(true)
}),
@@ -121,13 +121,4 @@ ServiceBusServiceClient.prototype._getPath = function (path) {
}
return path;
-};
-
-/**
-* Retrives the hostname.
-*
-* @return {string} The hostname.
-*/
-ServiceBusServiceClient.prototype._getHostname = function () {
- return this.namespace + '.' + this.host;
};
@@ -514,7 +514,7 @@ ServiceClient.prototype._setRequestUrl = function (webResource) {
var queryString = webResource.getQueryString(true);
// Build the full request url
- webResource.requestUrl = this.protocol + this._getHostname() + ":" + this.port + webResource.path + queryString;
+ webResource.requestUrl = this.protocol + this.host + ":" + this.port + webResource.path + queryString;
};
/**
@@ -190,7 +190,7 @@ ServiceManagementClient.prototype._buildRequestOptions = function(webResource, o
var requestOptions = {
url: url.format({
protocol: self._isHttps() ? 'https' : 'http',
- hostname: self._getHostname(),
+ hostname: self.host,
port: self.port,
pathname: webResource.path + webResource.getQueryString(true)
}),
@@ -302,11 +302,4 @@ ServiceManagementClient.prototype._setAgent = function(self, reqopts, isHTTPS) {
} else if (isHTTPS) {
reqopts.agent = new https.Agent(reqopts);
}
-};
-
-/**
-* Get service host name
-*/
-ServiceManagementClient.prototype._getHostname = function () {
- return this.host;
};
@@ -143,7 +143,7 @@ StorageServiceClient.prototype._buildRequestOptions = function (webResource, opt
webResource.addOptionalHeader(HeaderConstants.ACCEPT_HEADER, 'application/atom+xml,application/xml');
webResource.addOptionalHeader(HeaderConstants.ACCEPT_CHARSET_HEADER, 'UTF-8');
- webResource.addOptionalHeader(HeaderConstants.HOST_HEADER, this._getHostname() + ':' + this.port);
+ webResource.addOptionalHeader(HeaderConstants.HOST_HEADER, this.host + ':' + this.port);
if (options) {
if (options.timeoutIntervalInMs) {
@@ -170,7 +170,7 @@ StorageServiceClient.prototype._buildRequestOptions = function (webResource, opt
requestOptions = {
url: url.format({
protocol: self._isHttps() ? 'https:' : 'http:',
- hostname: self._getHostname(),
+ hostname: self.host,
port: self.port,
pathname: webResource.path + webResource.getQueryString(true)
}),
@@ -209,20 +209,6 @@ StorageServiceClient.prototype._getPath = function (path) {
return path;
};
-/**
-* Retrives the hostname taking into consideration the usePathStyleUri flag which indicates whether the account
-* should be a prefix for it or not.
-*
-* @return {string} The hostname.
-*/
-StorageServiceClient.prototype._getHostname = function () {
- if (this.usePathStyleUri) {
- return this.host;
- }
-
- return this.storageAccount + '.' + this.host;
-};
-
/**
* Sets the account credentials taking into consideration the isEmulated value and the environment variables:
* AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY.
@@ -112,7 +112,7 @@ WrapService.prototype._buildRequestOptions = function (webResource, options, cal
var requestOptions = {
url: url.format({
protocol: self._isHttps() ? 'https:' : 'http:',
- hostname: self._getHostname(),
+ hostname: self.host,
port: self.port,
pathname: webResource.path + webResource.getQueryString(true)
}),
@@ -141,15 +141,6 @@ WrapService.prototype._getPath = function (path) {
return path;
};
-/**
-* Retrives the hostname.
-*
-* @return {string} The hostname.
-*/
-WrapService.prototype._getHostname = function () {
- return this.acsNamespace + '.' + this.host;
-};
-
/**
* Validates a callback function.
*

0 comments on commit 865bcc4

Please sign in to comment.