tsibelman / aws-signer-v4-dot-net

Sign HttpRequestMessage using AWS Signature v4 using request information and credentials.
Apache License 2.0
72 stars 27 forks source link

Escape query parameters when getting canonical request #6

Closed romankuznetsov closed 5 years ago

romankuznetsov commented 5 years ago

This PR fixes #2 by escaping query parameters in the request. Query parameters must be escaped in upper case.

Here's how the string-to-sign looks before and after the fix. Before:

GET
/api
Action=UrlInfo&ResponseGroup=Rank,RankByCountry&Url=google.com
host:awis.us-west-1.amazonaws.com
x-amz-date:20181217T101437Z

host;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

After:

GET
/api
Action=UrlInfo&ResponseGroup=Rank%2CRankByCountry&Url=google.com
host:awis.us-west-1.amazonaws.com
x-amz-date:20181217T101437Z

host;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855