You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Yossi Tamari <yo...@yossi.at> on 2016/04/04 17:20:02 UTC

Invalid redirect URI

Hi,



I know this is an old subject, and related to the closed tickets
https://issues.apache.org/jira/browse/HTTPCLIENT-1204 and
https://issues.apache.org/jira/browse/HTTPCLIENT-1392, but it seems to be a
different case, and I’m not even sure it is not a bug.

If you go to some sites with an encoded UTF-8 URL, and get a redirect that
contains the same encoded value, DefaultRedirectStrategy throws an
exception.

For example:

Go to
http://www.vimeo.com/api/v2/%D0%9A%D1%83%D1%80%D0%BE%D1%87%D0%BA%D0%B8%D0%BD%D0%B0/info.xml
(which is the encode version of https://vimeo.com/api/v2/курочкина/info.xml).
You get a redirect to
https://www.vimeo.com/api/v2/%D0%9A%D1%83%D1%80%D0%BE%D1%87%D0%BA%D0%B8%D0%BD%D0%B0/info.xml.
This seems like a valid header/redirect to me, since it is an ASCII string,
with some encoded URL in it.
However, response.getFirstHeader("location") reads this as
https://vimeo.com/api/v2/Курочкина/info.xml, and then the
URIParser throws "java.net.URISyntaxException: Illegal character in path at
index 26", which leads the DefaultRedirectStrategy  to throw a
"org.apache.http.ProtocolException:
Invalid redirect URI".

Is this really a bug in the web-site (if so, it is pretty common) and not
in HC?
Any idea how I can get the correct URL?

Thanks,
Yossi.