Navigation Menu

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

AsyncHttpProviderUtils.getRedirectUri() throws IllegalArgumentException if "location" argument contains space characters. #268

Closed
amakarenko opened this issue Apr 3, 2013 · 5 comments
Assignees
Milestone

Comments

@amakarenko
Copy link

When I'm trying to fetch page from next URL "http://www.ebay.de/itm/FSC-Lifebook-E8310-Core2Duo-T8100-2-1GHz-4GB-DVD-RW-/150731406505?pt=DE_Technik_Computer_Peripherieger%C3%A4te_Notebooks&hash=item23184abca9#ht_1960wt_1140"

AsyncHttpClient is failing inside AsyncHttpProviderUtils.getRedirectUri() with exception:

java.lang.IllegalArgumentException: Illegal character in query at index 84: http://www.ebay.de/sch/sis.html;jsessionid=92D73F80262E3EBED7E115ED01035DDA?_nkw=FSC Lifebook E8310 Core2Duo T8100 2 1GHz 4GB DVD RW&_itemId=150731406505
at java.net.URI.create(URI.java:859) ~[na:1.7.0_09]
at java.net.URI.resolve(URI.java:1043) ~[na:1.7.0_09]
at com.ning.http.util.AsyncHttpProviderUtils.getRedirectUri(AsyncHttpProviderUtils.java:233) ~[async-http-client-1.7.12.jar:na]
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.redirect(NettyAsyncHttpProvider.java:2063) ~[async-http-client-1.7.12.jar:na]

Seams, that AsyncHttpProviderUtils.getRedirectUri() does not pre-process "location" argument, retrieved from "Location" Http Header.

@slandelle
Copy link
Contributor

Seems that even ebay doesn't respect the RFC... Sad internet...

@slandelle
Copy link
Contributor

As per the RFC, Location header must be a valid URI, with special characters properly encoded. In this case, the proper Location value should be http://www.ebay.de/sch/sis.html?_nkw=FSC%20Lifebook%20E8310%20Core2Duo%20T8100%202%201GHz%204GB%20DVD%20RW&_itemId=150731406505, with encoded blanks.

IMHO, the best way to fix this is to either add a dedicated config parameter, or use the existing useRawUrl to clean up the Location header.

@jfarcand WDYT?

@jfarcand
Copy link
Contributor

jfarcand commented May 1, 2013

@slandelle: I think we should use the useRawUrl as it will make it transparent!

@slandelle
Copy link
Contributor

Agree. OK, will do!

@ghost ghost assigned slandelle May 1, 2013
@slandelle
Copy link
Contributor

I finally went with a fallback strategy on URISyntaxException.

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

No branches or pull requests

3 participants