HTTPCLIENT-2051: corrected handling of 303 redirects
This commit is contained in:
parent
177fc804e5
commit
e26d537658
|
@ -142,11 +142,16 @@ public final class AsyncRedirectExec implements AsyncExecChainHandler {
|
|||
switch (statusCode) {
|
||||
case HttpStatus.SC_MOVED_PERMANENTLY:
|
||||
case HttpStatus.SC_MOVED_TEMPORARILY:
|
||||
case HttpStatus.SC_SEE_OTHER:
|
||||
if (Method.POST.isSame(request.getMethod())) {
|
||||
state.currentRequest = new BasicHttpRequest(Method.GET, redirectUri);
|
||||
state.currentEntityProducer = null;
|
||||
}
|
||||
break;
|
||||
case HttpStatus.SC_SEE_OTHER:
|
||||
if (!Method.GET.isSame(request.getMethod()) && !Method.HEAD.isSame(request.getMethod())) {
|
||||
state.currentRequest = new BasicHttpRequest(Method.GET, redirectUri);
|
||||
state.currentEntityProducer = null;
|
||||
}
|
||||
}
|
||||
if (state.currentRequest == null) {
|
||||
state.currentRequest = new BasicHttpRequest(request.getMethod(), redirectUri);
|
||||
|
|
|
@ -145,10 +145,14 @@ public final class RedirectExec implements ExecChainHandler {
|
|||
switch (statusCode) {
|
||||
case HttpStatus.SC_MOVED_PERMANENTLY:
|
||||
case HttpStatus.SC_MOVED_TEMPORARILY:
|
||||
case HttpStatus.SC_SEE_OTHER:
|
||||
if (Method.POST.isSame(request.getMethod())) {
|
||||
redirect = new HttpGet(redirectUri);
|
||||
}
|
||||
break;
|
||||
case HttpStatus.SC_SEE_OTHER:
|
||||
if (!Method.GET.isSame(request.getMethod()) && !Method.HEAD.isSame(request.getMethod())) {
|
||||
redirect = new HttpGet(redirectUri);
|
||||
}
|
||||
}
|
||||
if (redirect == null) {
|
||||
redirect = new BasicClassicHttpRequest(originalRequest.getMethod(), redirectUri);
|
||||
|
|
Loading…
Reference in New Issue