Hello, We have an issue with redirection handling in HttpClient 4.2.5 We have a JSP that contains the following code:
<%@ page session="false" contentType="text/html" buffer="8kb" %> <html> <body> <% response.sendRedirect("http://localhost:8080/?[]!@#$%^&*()"); %> </body> </html> As you can see it contains unsafe characters. It fails with: Caused by: org.apache.http.ProtocolException: Invalid redirect URI: http://localhost:8080/?[]!@#$%^&*() at org.apache.http.impl.client.DefaultRedirectStrategy.createLocationURI(DefaultRedirectStrategy.java:197) at org.apache.http.impl.client.DefaultRedirectStrategy.getLocationURI(DefaultRedirectStrategy.java:148) at org.apache.http.impl.client.DefaultRedirectStrategy.getRedirect(DefaultRedirectStrategy.java:217) at org.apache.http.impl.client.DefaultRequestDirector.handleResponse(DefaultRequestDirector.java:1105) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:548) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906) ... 9 more Caused by: java.net.URISyntaxException: Malformed escape pair at index 29: http://localhost:8080/?[]!@#$%^&*() at java.net.URI$Parser.fail(URI.java:2810) at java.net.URI$Parser.scanEscape(URI.java:2940) at java.net.URI$Parser.scan(URI.java:2963) at java.net.URI$Parser.checkChars(URI.java:2981) at java.net.URI$Parser.parse(URI.java:3029) at java.net.URI.<init>(URI.java:577) at org.apache.http.impl.client.DefaultRedirectStrategy.createLocationURI(DefaultRedirectStrategy.java:195) ... 14 more It succeeds with Java Implementation. -- Cordialement. Philippe Mouawad.