commit | 53e172553df2dbb1029c36f9e6df1c54a8f02157 | [log] [tgz] |
---|---|---|
author | Oleg Kalnichevski <olegk@apache.org> | Mon Feb 17 13:38:43 2020 +0100 |
committer | Oleg Kalnichevski <olegk@apache.org> | Mon Feb 17 14:56:31 2020 +0100 |
tree | 23526c92e61dea6d3fb295a15a6399f71a834dda | |
parent | 42cae6999cd81a0ed31581d2b822bffdfe81acae [diff] |
HTTPCLIENT-2051: Change POST to GET for 301, 302 and 303 redirects. Other unsafe methods to be redirected as is.
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRedirectExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRedirectExec.java index ef7a138..03a770d 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRedirectExec.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRedirectExec.java
@@ -143,7 +143,7 @@ case HttpStatus.SC_MOVED_PERMANENTLY: case HttpStatus.SC_MOVED_TEMPORARILY: case HttpStatus.SC_SEE_OTHER: - if (!Method.isSafe(request.getMethod())) { + if (Method.POST.isSame(request.getMethod())) { state.currentRequest = new BasicHttpRequest(Method.GET, redirectUri); state.currentEntityProducer = null; }
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/RedirectExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/RedirectExec.java index bdd3219..d6ec2f5 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/RedirectExec.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/RedirectExec.java
@@ -146,7 +146,7 @@ case HttpStatus.SC_MOVED_PERMANENTLY: case HttpStatus.SC_MOVED_TEMPORARILY: case HttpStatus.SC_SEE_OTHER: - if (!Method.isSafe(request.getMethod())) { + if (Method.POST.isSame(request.getMethod())) { redirect = new HttpGet(redirectUri); } }