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 2016/06/18 12:17:21 UTC

svn commit: r1748976 - /httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequestExecutor.java

Author: olegk
Date: Sat Jun 18 12:17:21 2016
New Revision: 1748976

URL: http://svn.apache.org/viewvc?rev=1748976&view=rev
Log:
HTTPCORE-422: HttpAsyncResponseConsumer#onEntityEnclosed is triggered for HEAD responses

Modified:
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequestExecutor.java

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequestExecutor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequestExecutor.java?rev=1748976&r1=1748975&r2=1748976&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequestExecutor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequestExecutor.java Sat Jun 18 12:17:21 2016
@@ -324,10 +324,6 @@ public class HttpAsyncRequestExecutor im
             state.setEarlyResponse(true);
         }
 
-        handler.responseReceived(response);
-
-        state.setResponseState(MessageState.BODY_STREAM);
-
         final boolean pipelined = handler.getClass().getAnnotation(Pipelined.class) != null;
         final HttpRequest request;
         if (pipelined) {
@@ -340,8 +336,12 @@ public class HttpAsyncRequestExecutor im
             }
         }
 
-        if (!canResponseHaveBody(request, response)) {
+        if (canResponseHaveBody(request, response)) {
+            handler.responseReceived(response);
+            state.setResponseState(MessageState.BODY_STREAM);
+        } else {
             response.setEntity(null);
+            handler.responseReceived(response);
             conn.resetInput();
 
             if (!state.isEarlyResponse()) {