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