Patches: Browse | Submit New | Admin

[#29664] patch for allowing response-* params

Date:
2012-11-06 12:44
Priority:
3
Submitted By:
Andrea Ercolino (aercolino)
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
patch for allowing response-* params

Detailed description
I've added support into aws-s3 for response-* params and the likes (I needed to change the name of some downloaded
files).

I've kept changes to a minimum. They are essentially:
  1. make public AWS::S3::Authentication::Signature#canonical_string
  2. make public AWS::S3::Authentication::CanonicalString#extract_significant_parameter, and add support here for all
params provided into request.path
  3. call canonical_string.extract_significant_parameter also from QueryString#build and adjust the result accordingly
  4. suppress params from path in AWS::S3::Connection#url_for after building the query string
The really important bit is that extract_significant_parameter needs to unescape params when building CanonicalString
but not when building QueryString.

Notes:
  * I've deleted the misleading comment above QueryString#build, in fact sorting is only needed
in extract_significant_parameter so that Amazon can correctly compute the expected signature.
  * AWS::S3::Connection#url_for only allows authenticated response-* params... maybe this limitation should be removed
in the future.

Based on:
  * https://github.com/amazonwebservices/aws-sdk-for-ruby/blob/master/lib/aws/s3/request.rb
  * http://blog.yorkxin.org/2011/02/01/rightaws-get-link-response

Example:
---
  filename = "my nice filename.txt"
  content_disposition = AWS::S3::Authentication::CanonicalString::cgi_escape("attachment;
filename=\"#{filename}\"")
  object = "#{path}?response-content-disposition=#{content_disposition}"
  AWS::S3::S3Object.url_for(object, bucket, :expires_in => 2.hours)
---

Thanks,
--Andrea

Add A Comment: Notepad

Please login


Followup

Message
Date: 2012-11-07 21:11
Sender: Andrea Ercolino

I've found the aws-s3 project on github and have forked it. Please
refer to
https://github.com/aercolino/aws-s3 for latest info about my
patch. In
particular, the simpler branch I have there is what I'm currently
using myself.

Attached Files:

Name Description Download
aws-s3-0.6.2-authentication.patch Download
aws-s3-0.6.2-connection.patch Download
aws-s3-0.6.2-authentication.patch this fixes a little issue with empty strings Download

Changes:

Field Old Value Date By
File Added5887: aws-s3-0.6.2-authentication.patch2012-11-06 14:54aercolino
File Added5886: aws-s3-0.6.2-connection.patch2012-11-06 12:46aercolino
File Added5885: aws-s3-0.6.2-authentication.patch2012-11-06 12:46aercolino