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/10/01 07:34:59 UTC

[httpcomponents-core] branch 4.4.x updated: 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 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 2d03d03  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
2d03d03 is described below

commit 2d03d03bfb3a5d5deb82c96e2bc440fd91519b1d
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();
+    }
+
 }