Skip to content

Commit

Permalink
JSSE: return cached SNI request on Server side
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruby Martin committed Dec 5, 2024
1 parent 6e69cb2 commit e088bed
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/java/com/wolfssl/provider/jsse/WolfSSLImplementSSLSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ public String[] getPeerSupportedSignatureAlgorithms() {
* Return a list of all SNI server names of the requested Server Name
* Indication (SNI) extension.
*
* @return non-null immutable List of SNIServerNames. List may be emtpy
* @return non-null immutable List of SNIServerNames. List may be empty
* if no SNI names were requested.
*/
@Override
Expand All @@ -942,7 +942,20 @@ public synchronized List<SNIServerName> getRequestedServerNames()
}

try {
sniRequestArr = this.ssl.getClientSNIRequest();
/* Return SNI name saved by Client
* or return cached request name from Server
* Currently WolfSSL.WOLFSSL_SNI_HOST_NAME is the only
* supported type */
WolfSSLDebug.log(getClass(), WolfSSLDebug.INFO,
"calling getRequestedServerNames (" +
this.getSideString() + ")");
if (this.ssl.getSide() == WolfSSL.WOLFSSL_CLIENT_END){
sniRequestArr = this.ssl.getClientSNIRequest();
} else {
sniRequestArr = this.ssl.getSNIRequest((byte)WolfSSL.
WOLFSSL_SNI_HOST_NAME).getBytes();
}

if (sniRequestArr != null) {
SNIHostName sniName = new SNIHostName(sniRequestArr);
sniNames.add(sniName);
Expand Down

0 comments on commit e088bed

Please sign in to comment.