From 5c99d8b09f1ea05b9d86118166853f65ff04355a Mon Sep 17 00:00:00 2001 From: Yuri Schimke Date: Mon, 2 Oct 2023 21:37:13 +0100 Subject: [PATCH] Avoid hanging on takeHeaders (incorrect 103 handling) when response body is empty. (#7954) (cherry picked from commit 7308264c0eb7d48136705858b67ef2fc3977b164) --- .../src/main/kotlin/okhttp3/internal/http2/Http2Stream.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/okhttp/src/main/kotlin/okhttp3/internal/http2/Http2Stream.kt b/okhttp/src/main/kotlin/okhttp3/internal/http2/Http2Stream.kt index 3226b4f09212..1d0278d7589d 100644 --- a/okhttp/src/main/kotlin/okhttp3/internal/http2/Http2Stream.kt +++ b/okhttp/src/main/kotlin/okhttp3/internal/http2/Http2Stream.kt @@ -258,12 +258,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