LibHTTP: Tolerate extra \r\n in chunked-encoding last block size

Some servers put CR/LF there, so let's tolerate that behaviour.
Fixes #18151.
This commit is contained in:
Ali Mohammad Pur 2023-04-02 20:24:35 +03:30 committed by Andreas Kling
parent 289285cd6e
commit c7409af627
Notes: sideshowbarker 2024-07-17 09:47:09 +09:00

View File

@ -416,6 +416,9 @@ void Job::on_socket_connected()
auto size_data = maybe_size_data.release_value();
if (m_should_read_chunk_ending_line) {
// NOTE: Some servers seem to send an extra \r\n here despite there being no size.
// This makes us tolerate that.
size_data = size_data.trim("\r\n"sv, TrimMode::Right);
VERIFY(size_data.is_empty());
m_should_read_chunk_ending_line = false;
continue;