From 1aa6b93cf539c461f9a4fca4f40f43c2b2337b78 Mon Sep 17 00:00:00 2001 From: Trevor Rowe Date: Fri, 5 Jun 2015 13:40:33 -0700 Subject: [PATCH] Fixed v2 signer. --- aws-sdk-core/lib/aws-sdk-core/signers/v2.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/aws-sdk-core/lib/aws-sdk-core/signers/v2.rb b/aws-sdk-core/lib/aws-sdk-core/signers/v2.rb index 80b0831e6ee..b8effe0ab3f 100644 --- a/aws-sdk-core/lib/aws-sdk-core/signers/v2.rb +++ b/aws-sdk-core/lib/aws-sdk-core/signers/v2.rb @@ -25,14 +25,13 @@ def signature(http_request, params) def string_to_sign(http_request, params) [ http_request.http_method, - host(http_request), - http_request.endpoint.path, + host(http_request.endpoint), + path(http_request.endpoint), params.to_s, ].join("\n") end - def host(http_request) - endpoint = http_request.endpoint + def host(endpoint) host = endpoint.host.downcase if (endpoint.scheme == 'http' && endpoint.port != 80) || @@ -43,6 +42,10 @@ def host(http_request) host end + def path(endpoint) + endpoint.path == '' ? '/' : endpoint.path + end + end end end