You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2014/02/07 16:18:19 UTC
[jira] [Resolved] (HTTPCLIENT-1456) ClientProtocolException occurs
when retries after receiving 503
[ https://issues.apache.org/jira/browse/HTTPCLIENT-1456?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oleg Kalnichevski resolved HTTPCLIENT-1456.
-------------------------------------------
Resolution: Fixed
Fix Version/s: 4.4 Alpha1
Fix committed to SVN trunk and 4.3.x branch.
Please review / re-test with the latest SVN snapshot.
Oleg
> ClientProtocolException occurs when retries after receiving 503
> ---------------------------------------------------------------
>
> Key: HTTPCLIENT-1456
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1456
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient
> Affects Versions: 4.3.2
> Reporter: Liu Kumai
> Priority: Minor
> Fix For: 4.3.3, 4.4 Alpha1
>
> Attachments: HTTPCLIENT-1456.patch
>
>
> When HttpClient retries a POST request after receiving 503 (service temporary unavailable), ClientProtocolException occurs. On second request, Content-Length header is already set and the RequestContent created by HttpClientBuilder doesn't allow overriding it.
> There's a workaround:
> {code}
> HttpClientBuilder builder = HttpClientBuilder.create();
> builder.setServiceUnavailableRetryStrategy(new DefaultServiceUnavailableRetryStrategy(2, 100));
> builder.addInterceptorFirst(new HttpRequestInterceptor() {
> @Override
> public void process(HttpRequest request, HttpContext context) throws HttpException, IOException {
> if (request.containsHeader(HTTP.CONTENT_LEN)) {
> request.removeHeaders(HTTP.CONTENT_LEN);
> }
> }
> });
> {code}
> I think HttpClientBuilder should provide an option like this:
> {code}
> HttpClientBuilder.create()
> .setServiceUnavailableRetryStrategy(new DefaultServiceUnavailableRetryStrategy()
> .enableOverrideContentLength()
> ...
> {code}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org