From 860578ca5f407767e60fb80e5765ec98de5675c5 Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Fri, 7 Feb 2014 15:16:28 +0000 Subject: [PATCH] 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 --- RELEASE_NOTES.txt | 3 +++ .../http/impl/execchain/ServiceUnavailableRetryExec.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index 92f2069f9..e10b4a9b2 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -4,6 +4,9 @@ Changes for 4.4-alpha1 Changelog: ------------------- +* [HTTPCLIENT-1456] Request retrial after status 503 causes ClientProtocolException. + Contributed by Oleg Kalnichevski + * [HTTPCLIENT-1454] Make connection operator APIs public. Contributed by Tamas Cservenak diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java b/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java index d12ac496c..a32488195 100644 --- a/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java +++ b/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java @@ -32,6 +32,7 @@ import java.io.InterruptedIOException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.http.Header; import org.apache.http.HttpException; import org.apache.http.annotation.Immutable; import org.apache.http.client.ServiceUnavailableRetryStrategy; @@ -77,6 +78,7 @@ public class ServiceUnavailableRetryExec implements ClientExecChain { final HttpRequestWrapper request, final HttpClientContext context, final HttpExecutionAware execAware) throws IOException, HttpException { + final Header[] origheaders = request.getAllHeaders(); for (int c = 1;; c++) { final CloseableHttpResponse response = this.requestExecutor.execute( route, request, context, execAware); @@ -93,6 +95,7 @@ public class ServiceUnavailableRetryExec implements ClientExecChain { throw new InterruptedIOException(); } } + request.setHeaders(origheaders); } else { return response; }