-
Notifications
You must be signed in to change notification settings - Fork 6
chore: Bump ktor to 3.2.3 (WPB-8645) #3590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 10 commits
032773f
7a5dce8
b02477d
36a809d
8de25e2
6a9107d
b7e167e
adedf76
f4fa102
a7a047c
c62ff78
00c1198
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,7 +12,7 @@ compose-material3 = "1.0.0-alpha01" | |||||
| compose-jetbrains = "1.8.2" | ||||||
| fileKit = "0.10.0-beta04" | ||||||
| android-security = "1.1.0-alpha06" | ||||||
| ktor = "2.3.10" | ||||||
| ktor = "3.2.3" | ||||||
| okio = "3.9.0" | ||||||
| ok-http = "4.12.0" | ||||||
| # 3.0.1 with a fix for a bug https://github.com/mockative/mockative/issues/143 uploaded to a temporary repo | ||||||
|
|
@@ -45,7 +45,7 @@ core-crypto = "8.0.1" | |||||
| core-crypto-multiplatform = "0.6.0-rc.3-multiplatform-pre1" | ||||||
| completeKotlin = "1.1.0" | ||||||
| desugar-jdk = "2.1.3" | ||||||
| kermit = "2.0.3" | ||||||
| kermit = "2.0.6" | ||||||
| detekt = "1.23.8" | ||||||
| agp = "8.10.1" | ||||||
| dokka = "2.0.0" | ||||||
|
|
@@ -71,7 +71,7 @@ jmh = "1.37" | |||||
| jmhReport = "0.9.6" | ||||||
| xerialDriver = "3.48.0.0" | ||||||
| kotlinx-io = "0.5.3" | ||||||
| cells-sdk = "0.1.1-alpha10" | ||||||
| cells-sdk = "0.1.1-alpha15" | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
This newer version has artifacts for all apple targets we support. So... no more warnings and we can ditch |
||||||
|
|
||||||
| [plugins] | ||||||
| # Home-made convention plugins | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,26 +21,24 @@ package com.wire.kalium.network | |
| import com.wire.kalium.logger.KaliumLogger | ||
| import com.wire.kalium.network.utils.obfuscatePath | ||
| import io.ktor.client.HttpClient | ||
| import io.ktor.client.HttpClientConfig | ||
| import io.ktor.client.plugins.HttpClientPlugin | ||
| import io.ktor.client.plugins.logging.DEFAULT | ||
| import io.ktor.client.plugins.logging.LogLevel | ||
| import io.ktor.client.plugins.logging.Logger | ||
| import io.ktor.client.plugins.logging.Logging | ||
| import io.ktor.client.plugins.observer.ResponseHandler | ||
| import io.ktor.client.plugins.observer.ResponseObserver | ||
| import io.ktor.client.request.HttpRequestBuilder | ||
| import io.ktor.client.request.HttpSendPipeline | ||
| import io.ktor.client.statement.HttpReceivePipeline | ||
| import io.ktor.client.statement.HttpResponsePipeline | ||
| import io.ktor.client.statement.readRawBytes | ||
| import io.ktor.http.Url | ||
| import io.ktor.http.content.OutgoingContent | ||
| import io.ktor.http.contentType | ||
| import io.ktor.util.AttributeKey | ||
| import io.ktor.util.InternalAPI | ||
| import io.ktor.utils.io.ByteReadChannel | ||
| import io.ktor.utils.io.charsets.Charset | ||
| import io.ktor.utils.io.core.readText | ||
| import io.ktor.utils.io.readRemaining | ||
| import kotlin.coroutines.cancellation.CancellationException | ||
|
|
||
| private val KaliumHttpCustomLogger = AttributeKey<KaliumHttpLogger>("KaliumHttpLogger") | ||
|
|
@@ -120,7 +118,6 @@ class KaliumKtorCustomLogging private constructor( | |
| } | ||
| } | ||
|
|
||
| @OptIn(InternalAPI::class) | ||
| private fun setupResponseLogging(client: HttpClient) { | ||
| client.receivePipeline.intercept(HttpReceivePipeline.State) { response -> | ||
| if (level == LogLevel.NONE || response.call.attributes.contains(DisableLogging)) return@intercept | ||
|
|
@@ -157,20 +154,20 @@ class KaliumKtorCustomLogging private constructor( | |
|
|
||
| if (!level.body) return | ||
|
|
||
| val observer: ResponseHandler = observer@{ | ||
| if (level == LogLevel.NONE || it.call.attributes.contains(DisableLogging)) { | ||
| return@observer | ||
| client.receivePipeline.intercept(HttpReceivePipeline.After) { response -> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did you test with this logger enabled, i remember using intercept will consume the response stream and later stages will not have anything to read There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes I can see the response in logs |
||
| if (level == LogLevel.NONE || response.call.attributes.contains(DisableLogging)) { | ||
| return@intercept | ||
| } | ||
|
|
||
| val logger = it.call.attributes[KaliumHttpCustomLogger] | ||
| val logger = response.call.attributes[KaliumHttpCustomLogger] | ||
|
|
||
| try { | ||
| logger.logResponseBody(it.contentType(), it.content) | ||
| logger.logResponseBody(response.contentType(), ByteReadChannel(response.readRawBytes())) | ||
| } catch (_: Throwable) { | ||
| } finally { | ||
| logger.closeResponseLog() | ||
| } | ||
| } | ||
| ResponseObserver.install(ResponseObserver(observer), client) | ||
| } | ||
|
|
||
| private fun logRequest(request: HttpRequestBuilder): OutgoingContent? { | ||
|
|
@@ -213,14 +210,6 @@ class KaliumKtorCustomLogging private constructor( | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * Configure and install [Logging] in [HttpClient]. | ||
| */ | ||
| @Suppress("FunctionNaming") | ||
| fun HttpClientConfig<*>.Logging(block: Logging.Config.() -> Unit = {}) { | ||
| install(Logging, block) | ||
| } | ||
|
|
||
| @Suppress("TooGenericExceptionCaught") | ||
| internal suspend inline fun ByteReadChannel.tryReadText(charset: Charset): String? = try { | ||
| readRemaining().readText(charset = charset) | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -33,11 +33,11 @@ import io.ktor.client.utils.buildHeaders | |||
| import io.ktor.http.HttpHeaders | ||||
| import io.ktor.http.HttpProtocolVersion | ||||
| import io.ktor.http.HttpStatusCode | ||||
| import io.ktor.util.InternalAPI | ||||
| import io.ktor.util.date.GMTDate | ||||
| import io.ktor.utils.io.ByteReadChannel | ||||
| import io.mockative.Mockable | ||||
| import kotlin.coroutines.CoroutineContext | ||||
| import io.ktor.utils.io.InternalAPI | ||||
|
||||
| import io.ktor.utils.io.InternalAPI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the goal of adding this @InternalAPI annotation?
If it's delicate, we can/should create an annotation of our own.
@RequiresOptIn(
level = RequiresOptIn.Level.ERROR,
message = "Some explanation here."
)
@Target(
AnnotationTarget.CLASS,
AnnotationTarget.TYPEALIAS,
AnnotationTarget.FUNCTION,
AnnotationTarget.PROPERTY,
AnnotationTarget.FIELD,
AnnotationTarget.CONSTRUCTOR,
AnnotationTarget.PROPERTY_SETTER,
AnnotationTarget.PROPERTY_SETTER
)
public annotation class InternalNetworkAPI
Uh oh!
There was an error while loading. Please reload this page.