From 95c787375dc297ad480cf3c306e3ef9910112905 Mon Sep 17 00:00:00 2001 From: Yuri Schimke Date: Sat, 22 Jul 2023 21:14:26 +0100 Subject: [PATCH] Avoid hanging on takeHeaders (incorrect 103 handling) when response body is empty. --- .../jvmMain/kotlin/okhttp3/internal/http2/Http2Stream.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/okhttp/src/jvmMain/kotlin/okhttp3/internal/http2/Http2Stream.kt b/okhttp/src/jvmMain/kotlin/okhttp3/internal/http2/Http2Stream.kt index 7adfbd2b91a6..1de5bc45d516 100644 --- a/okhttp/src/jvmMain/kotlin/okhttp3/internal/http2/Http2Stream.kt +++ b/okhttp/src/jvmMain/kotlin/okhttp3/internal/http2/Http2Stream.kt @@ -264,12 +264,12 @@ class Http2Stream internal constructor( if (this.errorCode != null) { return false } - if (source.finished && sink.finished) { - return false - } this.errorCode = errorCode this.errorException = errorException notifyAll() + if (source.finished && sink.finished) { + return false + } } connection.removeStream(id) return true @@ -491,7 +491,7 @@ class Http2Stream internal constructor( // But delay updating the stream flow control until that stream has been // consumed updateConnectionFlowControl(byteCount) - + // Notify that buffer size changed connection.flowControlListener.receivingStreamWindowChanged(id, readBytes, readBuffer.size) }