src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java
changeset 53018 8bf9268df0e2
parent 52427 3c6aa484536c
child 53064 103ed9569fc8
equal deleted inserted replaced
53017:e10a1f7aaa13 53018:8bf9268df0e2
  1201      * Called by connect, the layered constructor, and SSLServerSocket.
  1201      * Called by connect, the layered constructor, and SSLServerSocket.
  1202      */
  1202      */
  1203     synchronized void doneConnect() throws IOException {
  1203     synchronized void doneConnect() throws IOException {
  1204         // In server mode, it is not necessary to set host and serverNames.
  1204         // In server mode, it is not necessary to set host and serverNames.
  1205         // Otherwise, would require a reverse DNS lookup to get the hostname.
  1205         // Otherwise, would require a reverse DNS lookup to get the hostname.
  1206         if ((peerHost == null) || (peerHost.length() == 0)) {
  1206         if (peerHost == null || peerHost.isEmpty()) {
  1207             boolean useNameService =
  1207             boolean useNameService =
  1208                     trustNameService && conContext.sslConfig.isClientMode;
  1208                     trustNameService && conContext.sslConfig.isClientMode;
  1209             useImplicitHost(useNameService);
  1209             useImplicitHost(useNameService);
  1210         } else {
  1210         } else {
  1211             conContext.sslConfig.serverNames =
  1211             conContext.sslConfig.serverNames =
  1236         }
  1236         }
  1237 
  1237 
  1238         JavaNetInetAddressAccess jna =
  1238         JavaNetInetAddressAccess jna =
  1239                 SharedSecrets.getJavaNetInetAddressAccess();
  1239                 SharedSecrets.getJavaNetInetAddressAccess();
  1240         String originalHostname = jna.getOriginalHostName(inetAddress);
  1240         String originalHostname = jna.getOriginalHostName(inetAddress);
  1241         if ((originalHostname != null) &&
  1241         if (originalHostname != null && !originalHostname.isEmpty()) {
  1242                 (originalHostname.length() != 0)) {
       
  1243 
  1242 
  1244             this.peerHost = originalHostname;
  1243             this.peerHost = originalHostname;
  1245             if (conContext.sslConfig.serverNames.isEmpty() &&
  1244             if (conContext.sslConfig.serverNames.isEmpty() &&
  1246                     !conContext.sslConfig.noSniExtension) {
  1245                     !conContext.sslConfig.noSniExtension) {
  1247                 conContext.sslConfig.serverNames =
  1246                 conContext.sslConfig.serverNames =