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/05/01 13:34:22 UTC

[httpcomponents-core] 01/01: HTTPCORE-676: fixed incorrect handling of TLS renegotiation by non-blocking i/o sessions

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

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

commit 32620d1005fead628fe728c7e8e6a69930a1b6ac
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Sat May 1 15:26:20 2021 +0200

    HTTPCORE-676: fixed incorrect handling of TLS renegotiation by non-blocking i/o sessions
---
 .../apache/hc/core5/reactor/ssl/SSLIOSession.java    | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

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 4b90d93..24c04c4 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
@@ -289,14 +289,10 @@ public class SSLIOSession implements IOSession {
         }
     }
 
-    private void doRunTask() throws SSLException {
-        try {
-            final Runnable r = this.sslEngine.getDelegatedTask();
-            if (r != null) {
-                r.run();
-            }
-        } catch (final RuntimeException ex) {
-            throw convert(ex);
+    private void doRunTask() {
+        final Runnable r = this.sslEngine.getDelegatedTask();
+        if (r != null) {
+            r.run();
         }
     }
 
@@ -425,6 +421,10 @@ public class SSLIOSession implements IOSession {
                 }
                 return;
             }
+            // Is there a task pending?
+            if (this.sslEngine.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
+                doRunTask();
+            }
             // Need to toggle the event mask for this channel?
             final int oldMask = this.session.getEventMask();
             int newMask = oldMask;
@@ -438,10 +438,6 @@ public class SSLIOSession implements IOSession {
                 case NOT_HANDSHAKING:
                     newMask = this.appEventMask;
                     break;
-                case NEED_TASK:
-                    break;
-                case FINISHED:
-                    break;
             }
 
             if (this.endOfStream && !this.inPlain.hasData()) {