[ 
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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to