diff --git a/src/http.zig b/src/http.zig index 25d133bd44..a2d8661008 100644 --- a/src/http.zig +++ b/src/http.zig @@ -1069,6 +1069,11 @@ pub fn writeToStream(this: *HTTPClient, comptime is_ssl: bool, socket: NewHTTPCo this.state.request_stage = .done; stream_buffer.release(); stream.detach(); + if (this.flags.upgrade_state == .upgraded) { + this.state.flags.received_last_chunk = true; + // upgraded connection will end when the body is done (no half-open connections) + this.progressUpdate(is_ssl, if (is_ssl) &http_thread.https_context else &http_thread.http_context, socket); + } } else { // only report drain if we send everything and previous we had something to send if (!wasEmpty) {