From 637f2f2ed6abd53c21f09809d87d64774228e3dd Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Tue, 5 Mar 2024 09:14:13 -0700 Subject: [PATCH] LibProtocol: Keep reading until an error occurs for buffered reads When buffering is enabled for the entire protocol request, it's possible that the entirety of the file data might be available on the first read of the pipe passed from RequestServer. If the file is then closed on the RequestServer end, the client would never realize that the file is EOF and call the user-provided on_finish callback. By reading until there's an error, we expect to get an EAGAIN or similar non-blocking pipe error message if there is still more data. --- Userland/Libraries/LibProtocol/Request.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Userland/Libraries/LibProtocol/Request.cpp b/Userland/Libraries/LibProtocol/Request.cpp index acf8a5032d..93669de32b 100644 --- a/Userland/Libraries/LibProtocol/Request.cpp +++ b/Userland/Libraries/LibProtocol/Request.cpp @@ -69,7 +69,6 @@ void Request::stream_into(Stream& stream) break; // FIXME: What do we do if this fails? stream.write_until_depleted(read_bytes).release_value_but_fixme_should_propagate_errors(); - break; } while (true); if (m_internal_stream_data->read_stream->is_eof())