hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Liu Kumai (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCLIENT-1456) ClientProtocolException occurs when retries after receiving 503
Date Wed, 12 Feb 2014 05:55:19 GMT

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13898828#comment-13898828
] 

Liu Kumai commented on HTTPCLIENT-1456:
---------------------------------------

It works fine with latest 4.4-alpha1-SNAPSHOT.

Thanks 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


Mime
View raw message