fixes issue with useRawUrl, queryString decode/encode and redirecting #14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
Play Framework uses AHC. When we needed AHC to support multiple encodings, we had to encode everything ourself before passing it to AHC. For this to work we must use "useRawUrl" to prevent AHC from destroying our preencoded QueryStrring-params by trying to reencode it with utf-8 right before using the rebuilded url. We managed to get around all problems by tweaking how/when we gave the info to AHC.
The only problem that we found no solution for was how AHC was handling redirects with useRawUrl on.
If AHC gets the following redirect-Location when useRawUrls is on:
http://localhost:9003/rest/redirecttarget?data2=x%3D%26y
it wil first decode x%3D%26y into x=&y, then later add it to the rebuilded url as is.
The url used in the redirect will end up like this:
http://localhost:9003/rest/redirecttarget?data2=x=&y
This pullrequest fixes this issue by preventing AHC from decoding queryString-param names and values before adding them with addQueryParameter when useRawUrl is on.
This patch it by no means perfect, but it do fix the problem..