Skip to content

Commit c8030cc

Browse files
committed
include utf-8 specification in http header and replace "(" and ")" with their url encoded versions: %28 and %29 before signing the string.
1 parent 21f8538 commit c8030cc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/aws.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var genericAWSClient = function(obj) {
4242
var body = qs.stringify(query);
4343
var headers = {
4444
"Host": obj.host,
45-
"Content-Type": "application/x-www-form-urlencoded",
45+
"Content-Type": "application/x-www-form-urlencoded; charset=utf-8",
4646
"Content-Length": body.length
4747
};
4848

@@ -99,6 +99,8 @@ var genericAWSClient = function(obj) {
9999
// Amazon signature algorithm seems to require this
100100
stringToSign = stringToSign.replace(/'/g,"%27");
101101
stringToSign = stringToSign.replace(/\*/g,"%2A");
102+
stringToSign = stringToSign.replace(/\(/g,"%28");
103+
stringToSign = stringToSign.replace(/\)/g,"%29");
102104

103105
return hmacSha256(obj.secretAccessKey, stringToSign);
104106
}

0 commit comments

Comments
 (0)