Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Specify fully qualified hostname for endpoint.

With this commit, you can specify both an endpoint identifier, or the
fully qualified domain name of the endpoint host.

Closes #25.
Closes #3.
  • Loading branch information...
commit 0cbbd553dce263a391858ba51cdaa1aae2c5dd98 1 parent f7a5430
@bigeasy bigeasy authored
Showing with 4 additions and 5 deletions.
  1. +4 −5 lib/request.js
View
9 lib/request.js
@@ -57,19 +57,18 @@ invoke = function(endpoint, key, secret, command, parameters, callback) {
name = names[_i];
query.push(querystring.escape(name) + "=" + querystring.escape(map[name]));
}
- toSign = "GET\n" + ("ec2." + endpoint + ".amazonaws.com\n") + "/\n" + query.join("&");
+ if (!~endpoint.indexOf(".")) endpoint = "ec2." + endpoint + ".amazonaws.com";
+ toSign = "GET\n" + (endpoint + "\n") + "/\n" + query.join("&");
hmac = crypto.createHmac("sha256", secret);
hmac.update(toSign);
digest = querystring.escape(hmac.digest("base64"));
query.push("Signature=" + digest);
request = http.request({
port: 443,
- host: "ec2." + endpoint + ".amazonaws.com",
+ host: endpoint,
method: "GET",
path: "/?" + query.join("&"),
- headers: {
- host: "ec2." + endpoint + ".amazonaws.com"
- }
+ headers: { host: endpoint }
}, function(response) {
var body;
body = "";
Please sign in to comment.
Something went wrong with that request. Please try again.