arturobernalg commented on code in PR #744:
URL: 
https://github.com/apache/httpcomponents-core/pull/744#discussion_r4516352310


##########
httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpClientConnection.java:
##########
@@ -281,15 +282,22 @@ public void close() throws IOException {
                         socketOutputStream.close();
                     }
 
-                }, entity.getTrailers())) {
+                }, entity.getTrailers());
+        try {
             entity.writeTo(outStream);
+            outStream.close();
         } catch (final ResponseOutOfOrderException ex) {
-            if (len > 0) {
+            if (len != 0) {
                 this.consistent = false;
             }
+        } catch (final IOException ex) {

Review Comment:
   Agreed on RuntimeException. Added.



##########
httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpClientConnection.java:
##########
@@ -281,15 +282,22 @@ public void close() throws IOException {
                         socketOutputStream.close();
                     }
 
-                }, entity.getTrailers())) {
+                }, entity.getTrailers());
+        try {
             entity.writeTo(outStream);
+            outStream.close();
         } catch (final ResponseOutOfOrderException ex) {
-            if (len > 0) {
+            if (len != 0) {

Review Comment:
   CHUNKED is -1. Since we no longer close the output stream on an early 
response, the chunked message may remain incomplete, so the connection must not 
be reused.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to