mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibHTTP: Take the final EOF read notification into account
Fixes the HTTP part of #3691.
This commit is contained in:
parent
80cffdc0a1
commit
ddc255a6c0
Notes:
sideshowbarker
2024-07-19 00:04:05 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/ddc255a6c00 Pull-request: https://github.com/SerenityOS/serenity/pull/4831 Reviewed-by: https://github.com/awesomekling
1 changed files with 11 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue