Skip to content

tls_available support#1127

Merged
scottf merged 2 commits into
mainfrom
tls-available-support
Apr 22, 2024
Merged

tls_available support#1127
scottf merged 2 commits into
mainfrom
tls-available-support

Conversation

@scottf

@scottf scottf commented Apr 22, 2024

Copy link
Copy Markdown
Contributor

Add support for server setting of tls_available

@scottf scottf requested review from Jarema, piotrpio and wallyqs April 22, 2024 16:35
if (tlsFirst && sslContext == null) {
throw new IllegalStateException("SSL context required for tls handshake first");
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not used to check this before, but if there is no SSL Context, we can't do any tls anyway, so it's a fast fail essentially.

*/
public boolean isTLSRequired() {
return tlsFirst || this.sslContext != null;
return sslContext != null;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reflects checking tls first and ssl context in the builder

nonce = readBytes(jv, NONCE);
tlsRequired = readBoolean(jv, TLS);
tlsRequired = readBoolean(jv, TLS_REQUIRED);
tlsAvailable = readBoolean(jv, TLS_AVAILABLE);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

71: Better variable name
72: read the value from the json

}
}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole block is simplified.

  1. getOptions returns the options variable, just use the variable directly. There is no lazy loading or anything.
  2. No need to check 2.9.19 because websocket never does upgrade, it was just extraneous

@wallyqs wallyqs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@scottf scottf merged commit 3df1fd7 into main Apr 22, 2024
@scottf scottf deleted the tls-available-support branch April 22, 2024 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants