hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1748976 - /httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequestExecutor.java
Date Sat, 18 Jun 2016 12:17:21 GMT
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()) {



Mime
View raw message