HTTPCLIENT-1273: DecompressingHttpClient does not automatically consume response content in case of an i/o, HTTP or runtime exception thrown by the decompressing protocol interceptor leading to a potential connection leak
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1420613 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
278e06df47
commit
6425e97a02
|
@ -1,6 +1,11 @@
|
|||
Changes in trunk
|
||||
-------------------
|
||||
|
||||
* [HTTPCLIENT-1273] DecompressingHttpClient does not automatically consume response
|
||||
content in case of an i/o, HTTP or runtime exception thrown by the decompressing
|
||||
protocol interceptor leading to a potential connection leak.
|
||||
Contributed by Oleg Kalnichevski <olegk at apache.org>
|
||||
|
||||
* [HTTPCLIENT-1080] NTLM dead code commented out.
|
||||
Contributed by Karl Wright <DaddyWri at gmail.com>
|
||||
|
||||
|
|
|
@ -155,8 +155,24 @@ public class DecompressingHttpClient implements HttpClient {
|
|||
}
|
||||
acceptEncodingInterceptor.process(wrapped, context);
|
||||
HttpResponse response = backend.execute(target, wrapped, context);
|
||||
try {
|
||||
contentEncodingInterceptor.process(response, context);
|
||||
if (Boolean.TRUE.equals(context.getAttribute(ResponseContentEncoding.UNCOMPRESSED))) {
|
||||
response.removeHeaders("Content-Length");
|
||||
response.removeHeaders("Content-Encoding");
|
||||
response.removeHeaders("Content-MD5");
|
||||
}
|
||||
return response;
|
||||
} catch (HttpException ex) {
|
||||
EntityUtils.consume(response.getEntity());
|
||||
throw ex;
|
||||
} catch (IOException ex) {
|
||||
EntityUtils.consume(response.getEntity());
|
||||
throw ex;
|
||||
} catch (RuntimeException ex) {
|
||||
EntityUtils.consume(response.getEntity());
|
||||
throw ex;
|
||||
}
|
||||
} catch (HttpException e) {
|
||||
throw new ClientProtocolException(e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue