src/java.net.http/share/classes/jdk/internal/net/http/Http1Exchange.java
branchhttp-client-branch
changeset 56763 25821dd1d917
parent 56756 ba60eaef37d7
child 56795 03ece2518428
--- a/src/java.net.http/share/classes/jdk/internal/net/http/Http1Exchange.java	Fri Jun 15 11:53:32 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http1Exchange.java	Fri Jun 15 12:43:10 2018 +0100
@@ -285,6 +285,15 @@
             if (debug.on()) debug.log("asyncReceiver finished (failed=%s)", t);
             if (t != null) {
                 s.cancel();
+                // Don't complete exceptionally here as 't'
+                // might not be the right exception: it will
+                // not have been decorated yet.
+                // t is an exception raised by the read side,
+                // an EOFException or Broken Pipe...
+                // We are cancelling the BodyPublisher subscription
+                // and completing bodySentCF to allow the next step
+                // to flow and call readHeaderAsync, which will
+                // get the right exception from the asyncReceiver.
                 bodySentCF.complete(this);
             }
         }, executor);