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 2021/09/30 12:50:42 UTC

[httpcomponents-core] 01/01: HTTPCORE-687: non-blocking SSL I/O session can enter a tight loop if the SSL session gets closed by the protocol layer while there is still unprocessed data stuck in the protocol session buffer

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

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

commit bbd48a4f97cc1334a96df460b8476e6b1b41d678
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Thu Sep 30 14:50:07 2021 +0200

    HTTPCORE-687: non-blocking SSL I/O session can enter a tight loop if the SSL session gets closed by the protocol layer while there is still unprocessed data stuck in the protocol session buffer
---
 .../src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java  | 2 ++
 .../org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java     | 5 +++++
 .../org/apache/http/impl/nio/reactor/SessionOutputBufferImpl.java    | 5 +++++
 3 files changed, 12 insertions(+)

diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
index 0609c31..3bc7627 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
@@ -509,6 +509,8 @@ public class NHttpConnectionBase
             return;
         }
         this.status = CLOSING;
+        this.inbuf.clear();
+        this.hasBufferedInput = false;
         if (this.outbuf.hasData()) {
             this.session.setEvent(EventMask.WRITE);
         } else {
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java
index 4f9375d..f78a938 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java
@@ -412,4 +412,9 @@ public class SessionInputBufferImpl extends ExpandableBuffer implements SessionI
         return found ? tmpBuffer.toString() : null;
     }
 
+    @Override
+    public void clear() {
+        super.clear();
+    }
+
 }
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionOutputBufferImpl.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionOutputBufferImpl.java
index 1114538..1b9d20f 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionOutputBufferImpl.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionOutputBufferImpl.java
@@ -307,4 +307,9 @@ public class SessionOutputBufferImpl extends ExpandableBuffer implements Session
         }
     }
 
+    @Override
+    public void clear() {
+        super.clear();
+    }
+
 }