mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 07:34:57 +00:00
LibCore: Allow reads smaller than the buffered data size in IODevice
This restriction doesn't make much sense, a user should be free to consume the buffered data with as small a max_size as they desire. This fixes a possible RequestServer spin when talking to HTTP servers.
This commit is contained in:
parent
7ee3432ab6
commit
e112e6620f
1 changed files with 0 additions and 9 deletions
|
@ -47,15 +47,6 @@ ByteBuffer IODevice::read(size_t max_size)
|
|||
if (m_buffered_data.size() < max_size)
|
||||
populate_read_buffer(max(max_size - m_buffered_data.size(), 1024));
|
||||
|
||||
if (m_buffered_data.size() > max_size) {
|
||||
if (m_error)
|
||||
return {};
|
||||
if (m_eof) {
|
||||
dbgln("IODevice::read: At EOF but there's more than max_size({}) buffered", max_size);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
auto size = min(max_size, m_buffered_data.size());
|
||||
auto buffer_result = ByteBuffer::create_uninitialized(size);
|
||||
if (!buffer_result.has_value()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue