ladybird/Userland/Libraries/LibHTTP
Daniel Bertalan e9f0ebd4bd LibHTTP: Fix logic error leading to buffer over-read
When we receive HTTP payloads, we have to ensure that the number of
bytes read is *at most* the value specified in the Content-Length
header.

However, we did not use the correct value when calculating the truncated
size of the last payload. `m_buffered_size` does not store the total
number of bytes received, but rather the number of bytes that haven't
been read from us.

This means that if some data has already been read from us,
`m_buffered_size` is smaller than `m_received_size`. Because of this, we
ended up resizing the `payload` ByteBuffer to a larger size than its
contents. This garbage data was then read by consumers, producing this
warning when executing scripts:

> Extension byte 0xdc in 1 position after first byte 0xdc doesn't make
> sense.
2021-10-30 00:54:34 +03:30
..
CMakeLists.txt LibCore+LibHTTP+LibGfx: Switch to LibCompress 2021-03-03 23:42:32 +01:00
Forward.h Everywhere: Use "the SerenityOS developers." in copyright headers 2021-04-29 00:59:26 +02:00
HttpJob.cpp LibHTTP+LibGemini: Set underlying sockets as idle when detaching 2021-10-04 15:31:26 +02:00
HttpJob.h LibHTTP: Respect the 'Connection: close' header on keep-alive jobs 2021-09-30 11:46:37 +02:00
HttpRequest.cpp AK+Everywhere: Make Base64 decoding fallible 2021-10-23 19:16:40 +01:00
HttpRequest.h Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe 2021-09-06 01:53:26 +02:00
HttpResponse.cpp LibHTTP: Implement getting the correct reason phrase from HttpResponse 2021-06-11 11:37:15 +02:00
HttpResponse.h LibHTTP: Implement getting the correct reason phrase from HttpResponse 2021-06-11 11:37:15 +02:00
HttpsJob.cpp LibHTTP+LibGemini: Set underlying sockets as idle when detaching 2021-10-04 15:31:26 +02:00
HttpsJob.h LibHTTP: Respect the 'Connection: close' header on keep-alive jobs 2021-09-30 11:46:37 +02:00
Job.cpp LibHTTP: Fix logic error leading to buffer over-read 2021-10-30 00:54:34 +03:30
Job.h LibHTTP: Store Content-Length value in the HTTP Job class 2021-10-24 23:54:26 +02:00