Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare path escaping #38

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

jjb
Copy link

@jjb jjb commented Oct 11, 2011

Currently, if a file on s3 has a URI reserved character in its name, it's possible for it to make its way into the URL.

Some browsers make a correct guess about dealing with this, and others don't. Depending on one's definition of correct. The point is, they will make different guesses, resulting in the timeout signature being incorrect in some cases.

Uses rfc3986 reserved characters, without /, because slashes in the
s3 object name have already been accounted for when the name was created.
(i.e. the end-to-end expectation is that they are used as namespace delimiters
when used in URLs).

This patch also escapes spaces with percent encoding.

More info on what is considered reserved:

rfc 3986 specifies these as reserved characters in a URL:

    !*'();:@&=+$,/?#[]

of these, Amazon thinks these need to be escaped when it generates urls
from its web console:

    ';:@&=+$,?#[ ]

and Amazon thinks these DO NOT need to be escaped:

    !*()

Amazon escapes spaces with +

Ruby's URI provides two regexes. What it considers to be reserved is an inexplicable
subset of rfc3986

    URI::REGEXP::PATTERN::UNRESERVED
    -_.!~*'()a-zA-Z\\d

    URI::REGEXP::PATTERN::RESERVED
    ;/?:@&=+$,\\[\\]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant