summaryrefslogtreecommitdiff
path: root/Libraries/LibHTTP
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2021-01-06 22:09:29 +0330
committerAndreas Kling <kling@serenityos.org>2021-01-06 19:50:34 +0100
commitddc255a6c0026af70a7ca685c2fed24941e7df9c (patch)
tree2bf3182caa314e72e3f8e8dde7d349ec1d906915 /Libraries/LibHTTP
parent80cffdc0a12a58d6382a6bc3ce80b8effc1e5c91 (diff)
downloadserenity-ddc255a6c0026af70a7ca685c2fed24941e7df9c.zip
LibHTTP: Take the final EOF read notification into account
Fixes the HTTP part of #3691.
Diffstat (limited to 'Libraries/LibHTTP')
-rw-r--r--Libraries/LibHTTP/Job.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/Libraries/LibHTTP/Job.cpp b/Libraries/LibHTTP/Job.cpp
index c9aa3d7220..aa0672b259 100644
--- a/Libraries/LibHTTP/Job.cpp
+++ b/Libraries/LibHTTP/Job.cpp
@@ -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;