HTTPCLIENT-1456: Request retrial after status 503 causes ClientProtocolException

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1565678 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2014-02-07 15:16:28 +00:00
parent ba9d0565b9
commit 860578ca5f
2 changed files with 6 additions and 0 deletions

View File

@ -4,6 +4,9 @@ Changes for 4.4-alpha1
Changelog: Changelog:
------------------- -------------------
* [HTTPCLIENT-1456] Request retrial after status 503 causes ClientProtocolException.
Contributed by Oleg Kalnichevski <olegk at apache.org>
* [HTTPCLIENT-1454] Make connection operator APIs public. * [HTTPCLIENT-1454] Make connection operator APIs public.
Contributed by Tamas Cservenak <tamas at cservenak.net> Contributed by Tamas Cservenak <tamas at cservenak.net>

View File

@ -32,6 +32,7 @@ import java.io.InterruptedIOException;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.http.Header;
import org.apache.http.HttpException; import org.apache.http.HttpException;
import org.apache.http.annotation.Immutable; import org.apache.http.annotation.Immutable;
import org.apache.http.client.ServiceUnavailableRetryStrategy; import org.apache.http.client.ServiceUnavailableRetryStrategy;
@ -77,6 +78,7 @@ public class ServiceUnavailableRetryExec implements ClientExecChain {
final HttpRequestWrapper request, final HttpRequestWrapper request,
final HttpClientContext context, final HttpClientContext context,
final HttpExecutionAware execAware) throws IOException, HttpException { final HttpExecutionAware execAware) throws IOException, HttpException {
final Header[] origheaders = request.getAllHeaders();
for (int c = 1;; c++) { for (int c = 1;; c++) {
final CloseableHttpResponse response = this.requestExecutor.execute( final CloseableHttpResponse response = this.requestExecutor.execute(
route, request, context, execAware); route, request, context, execAware);
@ -93,6 +95,7 @@ public class ServiceUnavailableRetryExec implements ClientExecChain {
throw new InterruptedIOException(); throw new InterruptedIOException();
} }
} }
request.setHeaders(origheaders);
} else { } else {
return response; return response;
} }