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

S3 doesn't interpret URI paths with + signs correctly vs. Akka HTTP normalizing URIs #451

Closed
jrudolph opened this issue Oct 31, 2016 · 2 comments
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted help wanted Identifies issues that the core team will likely not have time to work on t:docs Issues related to the documentation
Milestone

Comments

@jrudolph
Copy link
Member

According to an AWS forum post, S3 mistakenly interprets + signs in the path portion of an URI as a space character. Instead, a file with a + sign in its path needs to be accessed by using the percent encoded representation of the plus sign, %2b. This is in violation of RFC 3986 which mandates that a literal plus sign or its percent encoded form are to be treated as equivalent. (Note, how this is different from the interpretation of the query portion of an http uri in which + signs actually are to be interpreted as a space character.)

Akka HTTP will never send out the + sign as percent encoded because it normalizes URIs on creation. This means that it isn't possible to access a file in S3 that contains a + sign in its path using Akka HTTP's URIs.

As a workaround, you can use the synthetic Raw-Request-Uri header to render the URI yourself and force Akka HTTP to send a plus sign in its percent encoded form like this:

HttpRequest(uri = "/ignored", headers = List(Raw-Request-URI("/a/b%2Bc/")))

I put the issue here to help people who also run into this problem. To resolve it we should document the issue more prominently.

@jrudolph jrudolph added help wanted Identifies issues that the core team will likely not have time to work on t:docs Issues related to the documentation 1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted labels Oct 31, 2016
@jrudolph jrudolph added this to the backlog milestone Oct 31, 2016
@ktoso
Copy link
Member

ktoso commented Nov 2, 2016

Agree that this is something we can put into docs, thanks for the writeup.

@easel
Copy link
Contributor

easel commented Dec 13, 2016

For reference, the working incantation is actually this:

  import akka.http.scaladsl.model.headers.`Raw-Request-URI`
  val x = HttpRequest(uri = "/ignored", headers=List(`Raw-Request-URI`("/a/b%2Bc")))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted help wanted Identifies issues that the core team will likely not have time to work on t:docs Issues related to the documentation
Projects
None yet
Development

No branches or pull requests

3 participants