summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2021-05-11 13:36:42 +0200
committerGitHub <noreply@github.com>2021-05-11 13:36:42 +0200
commit4ae244bc86782b3dc36257edcfabc2e38f510cf7 (patch)
tree12cc0a6906a618fd2d4fae23317a9ee811a37ee9
parent4f0fc6d74b24fbc7af2606afc1306cac95bc3704 (diff)
parentee907f7149dfae7f757bf9c7b257c1ba82a875ef (diff)
Merge pull request #17817 from vespa-engine/bjorncs/connection-log
Handle case where SslConnection is opened but SSL listener not invoked
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyConnectionLogger.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyConnectionLogger.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyConnectionLogger.java
index bbeccb61c8a..1923153f970 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyConnectionLogger.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyConnectionLogger.java
@@ -6,6 +6,7 @@ import com.yahoo.container.logging.ConnectionLogEntry;
import com.yahoo.container.logging.ConnectionLogEntry.SslHandshakeFailure.ExceptionEntry;
import com.yahoo.io.HexDump;
import com.yahoo.jdisc.http.ServerConfig;
+import org.eclipse.jetty.alpn.server.ALPNServerConnection;
import org.eclipse.jetty.http2.server.HTTP2ServerConnection;
import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint;
@@ -124,6 +125,14 @@ class JettyConnectionLogger extends AbstractLifeCycle implements Connection.List
if (info == null) return; // Closed connection already handled
if (connection instanceof HttpConnection) {
info.setHttpBytes(connection.getBytesIn(), connection.getBytesOut());
+ } else if (connection instanceof SslConnection) {
+ SSLEngine sslEngine = ((SslConnection) connection).getSSLEngine();
+ sslToConnectionInfo.remove(IdentityKey.of(sslEngine));
+ } else if (connection instanceof ALPNServerConnection) {
+ SSLEngine sslEngine = ((ALPNServerConnection) connection).getSSLEngine();
+ if (sslEngine != null) {
+ sslToConnectionInfo.remove(IdentityKey.of(sslEngine));
+ }
}
if (!endpoint.isOpen()) {
info.setClosedAt(System.currentTimeMillis());
@@ -170,6 +179,7 @@ class JettyConnectionLogger extends AbstractLifeCycle implements Connection.List
SSLEngine sslEngine = event.getSSLEngine();
handleListenerInvocation("SslHandshakeListener", "handshakeSucceeded", "sslEngine=%h", List.of(sslEngine), () -> {
ConnectionInfo info = sslToConnectionInfo.remove(IdentityKey.of(sslEngine));
+ if (info == null) return;
info.setSslSessionDetails(sslEngine.getSession());
});
}
@@ -180,6 +190,7 @@ class JettyConnectionLogger extends AbstractLifeCycle implements Connection.List
handleListenerInvocation("SslHandshakeListener", "handshakeFailed", "sslEngine=%h,failure=%s", List.of(sslEngine, failure), () -> {
log.log(Level.FINE, failure, failure::toString);
ConnectionInfo info = sslToConnectionInfo.remove(IdentityKey.of(sslEngine));
+ if (info == null) return;
info.setSslHandshakeFailure((SSLHandshakeException)failure);
});
}