LibHTTP: Take the final EOF read notification into account

Fixes the HTTP part of #3691.
This commit is contained in:
AnotherTest 2021-01-06 22:09:29 +03:30 committed by Andreas Kling
parent 80cffdc0a1
commit ddc255a6c0
Notes: sideshowbarker 2024-07-19 00:04:05 +09:00

View file

@ -125,6 +125,17 @@ void Job::on_socket_connected()
register_on_ready_to_read([&] {
if (is_cancelled())
return;
if (m_state == State::Finished) {
// This is probably just a EOF notification, which means we should receive nothing
// and then get eof() == true.
[[maybe_unused]] auto payload = receive(64);
// These assertions are only correct if "Connection: close".
ASSERT(payload.is_empty());
ASSERT(eof());
return;
}
if (m_state == State::InStatus) {
if (!can_read_line())
return;