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 2019/09/30 15:23:55 UTC

[httpcomponents-core] 03/03: Clear non-blocking SSLIOSession output buffer if the session has been closed in case there is still `close_notify` data stuck in it

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

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

commit 905902d5aa326e66c596bfdcc9ad60bac6c047f4
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Mon Sep 30 16:41:19 2019 +0200

    Clear non-blocking SSLIOSession output buffer if the session has been closed in case there is still `close_notify` data stuck in it
---
 .../src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
index a996610..883e4d2 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
@@ -466,6 +466,12 @@ public class SSLIOSession implements IOSession {
             // Acquire buffer
             final ByteBuffer outEncryptedBuf = this.outEncrypted.acquire();
 
+            // Clear output buffer if the session has been closed
+            // in case there is still `close_notify` data stuck in it
+            if (this.status == CLOSED) {
+                outEncryptedBuf.clear();
+            }
+
             // Perform operation
             int bytesWritten = 0;
             if (outEncryptedBuf.position() > 0) {