1
0
mirror of https://github.com/square/okhttp.git synced 2025-08-10 11:03:02 +03:00

Adopt HttpUrl's new Kotlin API

This commit is contained in:
Jesse Wilson
2019-05-20 21:01:04 -04:00
parent f4655995ca
commit e67ec3c51e
18 changed files with 64 additions and 64 deletions

View File

@@ -45,21 +45,21 @@ class JavaNetAuthenticator : okhttp3.Authenticator {
proxyAddress.hostName,
proxy.connectToInetAddress(url),
proxyAddress.port,
url.scheme(),
url.scheme,
challenge.realm,
challenge.scheme,
url.url(),
url.toUrl(),
Authenticator.RequestorType.PROXY
)
} else {
Authenticator.requestPasswordAuthentication(
url.host(),
url.host,
proxy.connectToInetAddress(url),
url.port(),
url.scheme(),
url.port,
url.scheme,
challenge.realm,
challenge.scheme,
url.url(),
url.toUrl(),
Authenticator.RequestorType.SERVER
)
}
@@ -80,7 +80,7 @@ class JavaNetAuthenticator : okhttp3.Authenticator {
@Throws(IOException::class)
private fun Proxy.connectToInetAddress(url: HttpUrl): InetAddress {
return when {
type() == Proxy.Type.DIRECT -> InetAddress.getByName(url.host())
type() == Proxy.Type.DIRECT -> InetAddress.getByName(url.host)
else -> (address() as InetSocketAddress).address
}
}