summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-10-04 11:44:21 +0330
committerAndreas Kling <kling@serenityos.org>2021-10-04 11:00:44 +0200
commite112e6620f0550eef6e2a4c43f287110dc30bea6 (patch)
tree85a1465ad7a2e2596b6a4af5eb6f18b99bea3b3f
parent7ee3432ab6c3b9e4f46d5cae83ad1edd345e9abf (diff)
downloadserenity-e112e6620f0550eef6e2a4c43f287110dc30bea6.zip
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.
-rw-r--r--Userland/Libraries/LibCore/IODevice.cpp9
1 files changed, 0 insertions, 9 deletions
diff --git a/Userland/Libraries/LibCore/IODevice.cpp b/Userland/Libraries/LibCore/IODevice.cpp
index 6e1c16c270..21bb4f3dfd 100644
--- a/Userland/Libraries/LibCore/IODevice.cpp
+++ b/Userland/Libraries/LibCore/IODevice.cpp
@@ -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()) {