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:35:04 UTC

[httpcomponents-core] branch 5.1.x updated: 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 5.1.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git


The following commit(s) were added to refs/heads/5.1.x by this push:
     new 352ffce  HTTPCORE-676: fixed incorrect handling of TLS renegotiation by non-blocking i/o sessions
352ffce is described below

commit 352ffce12385896a31d2569cc9e904dcab966177
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 90d67a6..45cd4a7 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
@@ -291,14 +291,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();
         }
     }
 
@@ -427,6 +423,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;
@@ -440,10 +440,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()) {