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/03/09 10:07:11 UTC

[httpcomponents-core] branch bug-fixes updated (e605bfc -> 95e22d8)

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

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


    from e605bfc  Bug fix: HTTP/1.1 stream duplexer when being in the graceful shutdown state can have null output handler
     add 69f884c  Merge branch 'bug-fixes'
     new c0f6701  Bug fix: corrected recursive method invocation
     new 95e22d8  Bug fix: non-blocking SSL I/O sessions fail to fire session disconnected event

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../hc/core5/http2/ssl/ConscryptSupport.java       |  2 +-
 .../hc/core5/reactor/InternalDataChannel.java      | 12 +++++++
 .../apache/hc/core5/reactor/ssl/SSLIOSession.java  | 39 ++++++----------------
 3 files changed, 24 insertions(+), 29 deletions(-)


[httpcomponents-core] 02/02: Bug fix: non-blocking SSL I/O sessions fail to fire session disconnected event

Posted by ol...@apache.org.
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 95e22d8ce52551c1201d312b1227f0916536e9a0
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Sat Mar 9 10:59:29 2019 +0100

    Bug fix: non-blocking SSL I/O sessions fail to fire session disconnected event
---
 .../hc/core5/reactor/InternalDataChannel.java      | 12 +++++++
 .../apache/hc/core5/reactor/ssl/SSLIOSession.java  | 39 ++++++----------------
 2 files changed, 23 insertions(+), 28 deletions(-)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataChannel.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataChannel.java
index a3de43f..a4ad176 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataChannel.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataChannel.java
@@ -249,6 +249,18 @@ final class InternalDataChannel extends InternalChannel implements ProtocolIOSes
                     }
 
                 },
+                new Callback<SSLIOSession>() {
+
+                    @Override
+                    public void execute(final SSLIOSession sslSession) {
+                        if (closed.compareAndSet(false, true)) {
+                            if (sessionListener != null) {
+                                sessionListener.disconnected(InternalDataChannel.this);
+                            }
+                        }
+                    }
+
+                },
                 handshakeTimeout))) {
             throw new IllegalStateException("TLS already activated");
         }
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 f2d7493..145a318 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
@@ -81,7 +81,8 @@ public class SSLIOSession implements IOSession {
     private final ByteChannel channel;
     private final SSLSessionInitializer initializer;
     private final SSLSessionVerifier verifier;
-    private final Callback<SSLIOSession> callback;
+    private final Callback<SSLIOSession> connectedCallback;
+    private final Callback<SSLIOSession> disconnectedCallback;
     private final AtomicLong bytesReadCount;
 
     private int appEventMask;
@@ -94,29 +95,6 @@ public class SSLIOSession implements IOSession {
     private TlsDetails tlsDetails;
 
     /**
-     * Creates new instance of {@code SSLIOSession} class with static SSL buffers.
-     *
-     * @param targetEndpoint target endpoint (applicable in client mode only). May be {@code null}.
-     * @param session I/O session to be decorated with the TLS/SSL capabilities.
-     * @param sslMode SSL mode (client or server)
-     * @param sslContext SSL context to use for this I/O session.
-     * @param initializer optional SSL session initializer. May be {@code null}.
-     * @param verifier optional SSL session verifier. May be {@code null}.
-     *
-     * @since 5.0
-     */
-    public SSLIOSession(
-            final NamedEndpoint targetEndpoint,
-            final IOSession session,
-            final SSLMode sslMode,
-            final SSLContext sslContext,
-            final SSLSessionInitializer initializer,
-            final SSLSessionVerifier verifier,
-            final Callback<SSLIOSession> callback) {
-        this(targetEndpoint, session, sslMode, sslContext, SSLBufferMode.STATIC, initializer, verifier, callback, null);
-    }
-
-    /**
      * Creates new instance of {@code SSLIOSession} class.
      *
      * @param session I/O session to be decorated with the TLS/SSL capabilities.
@@ -138,7 +116,8 @@ public class SSLIOSession implements IOSession {
             final SSLBufferMode sslBufferMode,
             final SSLSessionInitializer initializer,
             final SSLSessionVerifier verifier,
-            final Callback<SSLIOSession> callback,
+            final Callback<SSLIOSession> connectedCallback,
+            final Callback<SSLIOSession> disconnectedCallback,
             final Timeout connectTimeout) {
         super();
         Args.notNull(session, "IO session");
@@ -148,7 +127,8 @@ public class SSLIOSession implements IOSession {
         this.sslMode = sslMode;
         this.initializer = initializer;
         this.verifier = verifier;
-        this.callback = callback;
+        this.connectedCallback = connectedCallback;
+        this.disconnectedCallback = disconnectedCallback;
 
         this.appEventMask = session.getEventMask();
         if (this.sslMode == SSLMode.CLIENT && targetEndpoint != null) {
@@ -376,8 +356,8 @@ public class SSLIOSession implements IOSession {
                 final String applicationProtocol = ReflectionUtils.callGetter(this.sslEngine, "ApplicationProtocol", String.class);
                 this.tlsDetails = new TlsDetails(sslSession, applicationProtocol);
             }
-            if (this.callback != null) {
-                this.callback.execute(this);
+            if (this.connectedCallback != null) {
+                this.connectedCallback.execute(this);
             }
         }
     }
@@ -402,6 +382,9 @@ public class SSLIOSession implements IOSession {
         }
         if (this.status == CLOSED) {
             this.session.close();
+            if (disconnectedCallback != null) {
+                disconnectedCallback.execute(this);
+            }
             return;
         }
         // Need to toggle the event mask for this channel?


[httpcomponents-core] 01/02: Bug fix: corrected recursive method invocation

Posted by ol...@apache.org.
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 c0f670137df8d6340ef1c9a1a07f96bec92ae1e3
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Fri Mar 8 16:42:14 2019 +0100

    Bug fix: corrected recursive method invocation
---
 .../src/main/java/org/apache/hc/core5/http2/ssl/ConscryptSupport.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/ssl/ConscryptSupport.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/ssl/ConscryptSupport.java
index e1a9b9d..f8dd283 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/ssl/ConscryptSupport.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/ssl/ConscryptSupport.java
@@ -64,7 +64,7 @@ public final class ConscryptSupport {
                     sslEngine.setSSLParameters(sslParameters);
                 }
                 if (initializer != null) {
-                    initialize(endpoint, sslEngine);
+                    initializer.initialize(endpoint, sslEngine);
                 }
             }