dpickett/agcod — pull request #9 by billr578 (2013-02-25 20:21:30+00:00)
Title: [RFR] - Fix Signature V2 Implementation

This article proved to be pretty useful to get me started on the path of figuring this one out:

http://www.jamesmurty.com/2008/12/31/aws-query-signature-version-2/

It turned out that AWS didn't like the use of URI.encode. I did a little reading and it seems that URI.encode doesn't conform to certain standards, so I'm not surprised AWS didn't like what we were sending them. See a discussion here:

http://stackoverflow.com/questions/2824126/whats-the-difference-between-uri-escape-and-cgi-escape

Also, I think we want to pass in request_uri and not path when building the start of the string we're going to sign.

I started to use ERB::Util.url_encode but running the tests showed the need for another dependency to pass, so it seemed easier to just use CGI.escape which does what we wanted URI.encode to do, but actually works.