Patches: Browse | Submit New | Admin

[#14235] GET requests should escape '+' symbol

Date:
2007-09-26 05:21
Priority:
3
Submitted By:
Nobody
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
GET requests should escape '+' symbol

Detailed description
This is a known S3 issue, but a GET request should translate + into %2B.

Here is the fix for connection.rb:request()

        requester = Proc.new do 
          path    = self.class.prepare_path(path)
          path = path.gsub(/\+/,'%2B')  if verb == :get
          request = request_method(verb).new(path, headers)
          
Without this patch, AWS::S3 can not retrieve any keys with + signs in them.

For more info see Amazon S3 thread:
http://developer.amazonwebservices.com/connect/thread.jspa?threadID=16361&start=0&tstart=0

Add A Comment: Notepad

Please login


Followup

Message
Date: 2009-02-12 01:03
Sender: Michael Klein

A saner fix for this would be to remove the + from the unsafe
character Regexp that connection.rb#prepare_path() uses to uri-encode
the path:

  UNSAFE_URI = Regexp.new(URI::REGEXP::UNSAFE.source.sub(/\+/,'')
,false,'N').freeze
  def prepare_path(path)
    path = path.remove_extended unless path.utf8?
    URI.escape(path,UNSAFE_URI)
  end

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item