1
0
mirror of https://github.com/square/okhttp.git synced 2025-08-07 12:42:57 +03:00

Avoid InetAddress.getCanonicalHostName(). (#7607)

Just hard-coding 'localhost' is simpler and avoids problems where
the host machine's IP address has additional DNS registrations.

Closes: https://github.com/square/okhttp/issues/7603
This commit is contained in:
Jesse Wilson
2023-01-02 09:04:37 -05:00
committed by GitHub
parent eba89ae4a0
commit 847b5af240
7 changed files with 10 additions and 15 deletions

View File

@@ -367,7 +367,7 @@ open class PlatformRule @JvmOverloads constructor(
private val localhostHandshakeCertificatesWithRsa2048: HandshakeCertificates by lazy {
val heldCertificate = HeldCertificate.Builder()
.commonName("localhost")
.addSubjectAlternativeName(InetAddress.getByName("localhost").canonicalHostName)
.addSubjectAlternativeName("localhost")
.rsa2048()
.build()
return@lazy HandshakeCertificates.Builder()