1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

LibHTTP: Tolerate random whitespace in chunked encoding size field

Some servers decide to add newlines (and not \r\n) into that field, this
commit makes us tolerate that and not crash in cases like in #22463.

Fixes #22463.
This commit is contained in:
Ali Mohammad Pur 2023-12-31 17:31:29 +03:30 committed by Andreas Kling
parent 267040dde7
commit 75e60d3a68

View file

@ -413,7 +413,7 @@ void Job::on_socket_connected()
m_should_read_chunk_ending_line = false;
continue;
}
auto size_lines = size_data.view().lines();
auto size_lines = size_data.view().trim_whitespace().lines();
dbgln_if(JOB_DEBUG, "Job: Received a chunk with size '{}'", size_data);
if (size_lines.size() == 0) {
if (!m_socket->is_eof())