You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2013/08/08 11:39:19 UTC
svn commit: r1511652 - in /httpcomponents/httpclient/trunk/httpclient/src:
main/java/org/apache/http/impl/execchain/MainClientExec.java
test/java/org/apache/http/impl/execchain/TestMainClientExec.java
Author: olegk
Date: Thu Aug 8 09:39:19 2013
New Revision: 1511652
URL: http://svn.apache.org/r1511652
Log:
Minor performance optimization: do not consume content of an intermediate response if the underlying connection is not re-usable
Modified:
httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestMainClientExec.java
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java?rev=1511652&r1=1511651&r2=1511652&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java Thu Aug 8 09:39:19 2013
@@ -271,10 +271,8 @@ public class MainClientExec implements C
targetAuthState, proxyAuthState, route, request, response, context)) {
// Make sure the response body is fully consumed, if present
final HttpEntity entity = response.getEntity();
- EntityUtils.consume(entity);
if (connHolder.isReusable()) {
- // TODO consume response body on if connection is re-usable
- // (requires post 4.3-beta2 bug fix in HttpCore)
+ EntityUtils.consume(entity);
} else {
managedConn.close();
if (proxyAuthState.getState() == AuthProtocolState.SUCCESS
Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestMainClientExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestMainClientExec.java?rev=1511652&r1=1511651&r2=1511652&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestMainClientExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestMainClientExec.java Thu Aug 8 09:39:19 2013
@@ -528,7 +528,6 @@ public class TestMainClientExec {
final CloseableHttpResponse finalResponse = mainClientExec.execute(
route, request, context, execAware);
Mockito.verify(requestExecutor, Mockito.times(2)).execute(request, managedConn, context);
- Mockito.verify(instream1).close();
Mockito.verify(managedConn).close();
Mockito.verify(instream2, Mockito.never()).close();