1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 05:54:58 +00:00

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.
This commit is contained in:
Andrew Kaster 2024-03-05 09:14:13 -07:00 committed by Andreas Kling
parent 7e6918e14a
commit 637f2f2ed6

View file

@ -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())