Skip to content

Commit 897ce2d

Browse files
nice77Minnullin Niyaz
and
Minnullin Niyaz
authored
Unsafe client (#13)
* Add way to create an unsafe client * Add way to create an unsafe client * Add tests * Minor changes --------- Co-authored-by: Minnullin Niyaz <minnullin.niyaz@x5.ru>
1 parent 019488a commit 897ce2d

File tree

1 file changed

+2
-4
lines changed
  • kmp-socketio/src/appleMain/kotlin/com/piasy/kmp/socketio/engineio/transports

1 file changed

+2
-4
lines changed

kmp-socketio/src/appleMain/kotlin/com/piasy/kmp/socketio/engineio/transports/transport_impl.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import io.ktor.client.HttpClient
44
import io.ktor.client.HttpClientConfig
55
import io.ktor.client.engine.darwin.Darwin
66
import platform.Foundation.NSURLCredential
7-
import platform.Foundation.NSURLSessionAuthChallengePerformDefaultHandling
8-
import platform.Foundation.NSURLSessionAuthChallengeUseCredential
97
import platform.Foundation.create
108
import platform.Foundation.serverTrust
119
import platform.Security.SecTrustRef
@@ -18,9 +16,9 @@ actual fun httpClient(trustAllCerts: Boolean, config: HttpClientConfig<*>.() ->
1816
val serverTrust: SecTrustRef? = challenge.protectionSpace.serverTrust
1917
if (serverTrust != null) {
2018
val credential = NSURLCredential.create(trust = serverTrust)
21-
completionHandler(NSURLSessionAuthChallengeUseCredential.toLong(), credential)
19+
completionHandler(0, credential)
2220
} else {
23-
completionHandler(NSURLSessionAuthChallengePerformDefaultHandling.toLong(), null)
21+
completionHandler(1, null)
2422
}
2523
}
2624
}

0 commit comments

Comments
 (0)