Skip to content

Commit 69f26b1

Browse files
committed
Only verifyError() if requestCert, rejectUnauthorized true
1 parent 62e12ca commit 69f26b1

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

io/js/src/main/scala/fs2/io/net/tls/TLSContextPlatform.scala

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,14 @@ private[tls] trait TLSContextCompanionPlatform { self: TLSContext.type =>
8484
tlsSock.once(
8585
"secure",
8686
{ () =>
87-
val result = Option(tlsSock.ssl.verifyError())
88-
.map(e => new JavaScriptSSLException(js.JavaScriptException(e)))
89-
.toLeft(())
87+
val requestCert = options.requestCert.getOrElse(false)
88+
val rejectUnauthorized = options.rejectUnauthorized.getOrElse(true)
89+
val result =
90+
if (requestCert && rejectUnauthorized)
91+
Option(tlsSock.ssl.verifyError())
92+
.map(e => new JavaScriptSSLException(js.JavaScriptException(e)))
93+
.toLeft(())
94+
else Right(())
9095
dispatcher.unsafeRunAndForget(verifyError.complete(result))
9196
}
9297
)

0 commit comments

Comments
 (0)