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 2022/07/26 12:32:39 UTC

[httpcomponents-core] branch 4.4.x updated: HTTPCORE-720: discard any remaining decrypted application data after the TLS session has been closed by the local endpoint

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch 4.4.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git


The following commit(s) were added to refs/heads/4.4.x by this push:
     new a7ecbc3ea HTTPCORE-720: discard any remaining decrypted application data after the TLS session has been closed by the local endpoint
a7ecbc3ea is described below

commit a7ecbc3eaa8b210cb6ffbf2671c875690f2a3bb6
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Tue Jul 26 14:29:20 2022 +0200

    HTTPCORE-720: discard any remaining decrypted application data after the TLS session has been closed by the local endpoint
---
 .../main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java   | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
index 4d5e06962..96519200c 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
@@ -549,6 +549,14 @@ public class SSLIOSession implements IOSession, SessionBufferStatus, SocketAcces
             if (status == HandshakeStatus.NOT_HANDSHAKING || status == HandshakeStatus.FINISHED) {
                 decryptData();
             }
+            if (this.terminated) {
+                // Discard any remaining input data
+                final ByteBuffer inPlainBuf = this.inPlain.acquire();
+                inPlainBuf.clear();
+                if (inPlainBuf.position() == 0) {
+                    this.inPlain.release();
+                }
+            }
         } while (this.sslEngine.getHandshakeStatus() == HandshakeStatus.NEED_TASK);
         // Some decrypted data is available or at the end of stream
         return (this.appEventMask & SelectionKey.OP_READ) > 0