Revert "AK: Refill a BufferedStream when it has less than the
...requested size"
This reverts commit 13573a6c4b
.
Some clients of `BufferedStream` expect a non-blocking read by
`read_some` which the commit above made impossible by potentially
performing a blocking read. For example, the following command hangs:
pro http://ipecho.net/plain
This is caused by the HTTP job expecting to read the body of the
response which is included in the active buffer, but since the buffered
data size is less than the buffer passed into `read_some`, another
blocking read is performed before anything is returned.
By reverting this commit, all tests still pass and `pro` no longer
hangs. Note that because of another bug related to `stdout` / `stderr`
mixing and the absence of a line ending, there is no output to the
command above except a progress update.
This commit is contained in:
parent
489f9c3151
commit
9240233378
Notes:
sideshowbarker
2024-07-17 06:51:48 +09:00
Author: https://github.com/gmta Commit: https://github.com/SerenityOS/serenity/commit/9240233378 Pull-request: https://github.com/SerenityOS/serenity/pull/21037 Reviewed-by: https://github.com/trflynn89 ✅
1 changed files with 1 additions and 1 deletions
|
@ -55,7 +55,7 @@ public:
|
|||
return buffer;
|
||||
|
||||
// Fill the internal buffer if it has run dry.
|
||||
if (m_buffer.used_space() < buffer.size())
|
||||
if (m_buffer.used_space() == 0)
|
||||
TRY(populate_read_buffer());
|
||||
|
||||
// Let's try to take all we can from the buffer first.
|
||||
|
|
Loading…
Add table
Reference in a new issue