Alberto Quario
09/16/2022, 3:37 PMclient.request(url) {
HttpMethod.Get
accept(ContentType.Application.Json)
contentType(ContentType.Application.Json)
timeout { requestTimeoutMillis = 60 * 1000
connectTimeoutMillis = 5 * 1000
socketTimeoutMillis = 60 * 1000 }
}
Using ktor 2.0.3 we never had any problems, with version 2.1.0 and 2.1.1 sometimes the call fails with:
org.apache.http.ConnectionClosedException: Premature end of Content-Length delimited message body (expected: 41,606; received: 26,090)
Same code with the old ktor version started to work again correctly.
Anyone having the same problem? Any hint on how to fix it?
Thanks!Aleksei Tirman [JB]
09/28/2022, 10:26 AMConnectionClosedException
?Alberto Quario
09/28/2022, 11:45 AMRobert Jaros
02/27/2024, 3:00 PMRobert Jaros
02/27/2024, 3:00 PMorg.apache.http.ConnectionClosedException: Premature end of Content-Length delimited message body (expected: 12 689 932; received:
8 388 160)
at org.apache.http.impl.nio.codecs.LengthDelimitedDecoder.read(LengthDelimitedDecoder.java:89)
at io.ktor.client.engine.apache.ApacheResponseConsumer$consumeContent$1.invoke(ApacheResponseConsumer.kt:54)
at io.ktor.client.engine.apache.ApacheResponseConsumer$consumeContent$1.invoke(ApacheResponseConsumer.kt:53)
at io.ktor.utils.io.ByteBufferChannel.writeAvailable(ByteBufferChannel.kt:1472)
at io.ktor.utils.io.ByteWriteChannel$DefaultImpls.writeAvailable$default(ByteWriteChannel.kt:76)
at io.ktor.client.engine.apache.ApacheResponseConsumer.consumeContent(ApacheResponseConsumer.kt:53)
at org.apache.http.impl.nio.client.MainClientExec.consumeContent(MainClientExec.java:329)
at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.consumeContent(DefaultClientExchangeHandlerImpl.java:1
5
Robert Jaros
02/27/2024, 3:02 PMRobert Jaros
02/27/2024, 3:04 PMAlberto Quario
02/27/2024, 3:44 PMprivate val client = HttpClient(OkHttp)
Don't know what was causing the problem though...Robert Jaros
02/27/2024, 3:45 PMSuresh Maidaragi
02/28/2024, 10:10 AMAleksei Tirman [JB]
02/28/2024, 10:56 AMSuresh Maidaragi
02/28/2024, 11:32 AMAleksei Tirman [JB]
02/28/2024, 11:35 AMSuresh Maidaragi
02/28/2024, 12:44 PM