CHttpJob: If no "Content-Length" header was received, read until EOF

Instead of aborting after receiving the first chunk, we have to keep
reading until EOF.
This commit is contained in:
Andreas Kling 2019-08-04 09:25:14 +02:00
parent 6797f71e73
commit 273d9d6cf5
Notes: sideshowbarker 2024-07-19 12:54:34 +09:00

View file

@ -91,10 +91,13 @@ void CHttpJob::on_socket_connected()
}
buffer.append(payload.pointer(), payload.size());
bool ok;
if (buffer.size() >= m_headers.get("Content-Length").value_or("0").to_int(ok) && ok) {
m_state = State::Finished;
break;
auto content_length_header = m_headers.get("Content-Length");
if (content_length_header.has_value()) {
bool ok;
if (buffer.size() >= content_length_header.value().to_int(ok) && ok) {
m_state = State::Finished;
break;
}
}
}