Skip to content

Commit 74f1a4a

Browse files
committed
fix issue robaho#16 Unable to get client certificate because HttpsExchange.getSSLSession() returns null
2 parents 701d5b1 + 8355144 commit 74f1a4a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/java/robaho/net/httpserver/HttpConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public void debug() {
7979
}
8080

8181
public SSLSession getSSLSession() {
82-
return (socket instanceof SSLSocket ssl) ? ssl.getHandshakeSession() : null;
82+
return (socket instanceof SSLSocket ssl) ? ssl.getSession() : null;
8383
}
8484

8585
public boolean isSSL() {

src/test/java/robaho/net/httpserver/SSLSessionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void TestHasSslSession() throws IOException, URISyntaxException {
3434
var ctx = new SimpleSSLContext().get();
3535
httpsServer.setHttpsConfigurator(new MyHttpsConfigurator (ctx));
3636
httpsServer.createContext("/test", (HttpExchange he) -> {
37-
var sslSession = (HttpsExchange)he;
37+
var sslSession = ((HttpsExchange)he).getSSLSession();
3838
hasSslSession = sslSession!=null;
3939
he.sendResponseHeaders(200,0);
4040
try (var os = he.getResponseBody()) {

0 commit comments

Comments
 (0)