< prev index next >

src/java.base/share/classes/sun/security/ssl/ClientHello.java

Print this page

        

@@ -33,10 +33,11 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
+import java.util.Objects;
 import javax.net.ssl.SSLException;
 import javax.net.ssl.SSLHandshakeException;
 import javax.net.ssl.SSLPeerUnverifiedException;
 import javax.net.ssl.SSLProtocolException;
 import static sun.security.ssl.ClientAuthType.CLIENT_AUTH_REQUIRED;

@@ -966,28 +967,15 @@
                     throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                             "Client initiated renegotiation is not allowed");
                 }
             }
 
-            // Consume a Session Ticket Extension if it exists
-            SSLExtension[] ext = new SSLExtension[]{
-                    SSLExtension.CH_SESSION_TICKET
-            };
-            clientHello.extensions.consumeOnLoad(shc, ext);
-
-            // Does the client want to resume a session?
-            if (clientHello.sessionId.length() != 0 || shc.statelessResumption) {
-                SSLSessionContextImpl cache = (SSLSessionContextImpl)shc.sslContext
-                        .engineGetServerSessionContext();
-
-                SSLSessionImpl previous;
-                // Use the stateless session ticket if provided
-                if (shc.statelessResumption) {
-                    previous = shc.resumingSession;
-                } else {
-                    previous = cache.get(clientHello.sessionId.getId());
-                }
+            // Is it an abbreviated handshake?
+            if (clientHello.sessionId.length() != 0) {
+                SSLSessionImpl previous = ((SSLSessionContextImpl)shc.sslContext
+                            .engineGetServerSessionContext())
+                            .get(clientHello.sessionId.getId());
 
                 boolean resumingSession =
                         (previous != null) && previous.isRejoinable();
                 if (!resumingSession) {
                     if (SSLLogger.isOn &&

@@ -1061,24 +1049,18 @@
 
                 // So far so good.  Note that the handshake extensions may reset
                 // the resuming options later.
                 shc.isResumption = resumingSession;
                 shc.resumingSession = resumingSession ? previous : null;
-
-                if (!resumingSession && SSLLogger.isOn &&
-                        SSLLogger.isOn("ssl,handshake")) {
-                    SSLLogger.fine("Session not resumed.");
-                }
             }
 
             // cache the client random number for further using
             shc.clientHelloRandom = clientHello.clientRandom;
 
             // Check and launch ClientHello extensions.
-            SSLExtension[] extTypes = shc.sslConfig.getExclusiveExtensions(
-                    SSLHandshake.CLIENT_HELLO,
-                    Arrays.asList(SSLExtension.CH_SESSION_TICKET));
+            SSLExtension[] extTypes = shc.sslConfig.getEnabledExtensions(
+                    SSLHandshake.CLIENT_HELLO);
             clientHello.extensions.consumeOnLoad(shc, extTypes);
 
             //
             // update
             //

@@ -1292,29 +1274,15 @@
                     throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                             "Client initiated renegotiation is not allowed");
                 }
             }
 
-
-            // Does the client want to resume a session?
+            // Is it an abbreviated handshake?
             if (clientHello.sessionId.length() != 0) {
-                SSLSessionContextImpl cache = (SSLSessionContextImpl)shc.sslContext
-                        .engineGetServerSessionContext();
-
-                // Consume a Session Ticket Extension if it exists
-                SSLExtension[] ext = new SSLExtension[]{
-                        SSLExtension.CH_SESSION_TICKET
-                };
-                clientHello.extensions.consumeOnLoad(shc, ext);
-
-                SSLSessionImpl previous;
-                // Use stateless session ticket if provided.
-                if (shc.statelessResumption) {
-                    previous = shc.resumingSession;
-                } else {
-                    previous = cache.get(clientHello.sessionId.getId());
-                }
+                SSLSessionImpl previous = ((SSLSessionContextImpl)shc.sslContext
+                            .engineGetServerSessionContext())
+                            .get(clientHello.sessionId.getId());
 
                 boolean resumingSession =
                         (previous != null) && previous.isRejoinable();
                 if (!resumingSession) {
                     if (SSLLogger.isOn &&
< prev index next >