LibHTTP: Bump max HTTP header size up to 32KiB

Apparently discord likes to feed us headers as big as 6KiB, so clearly
there are large headers out there in the wild.
For reference, Apache's limit is 8KiB, and IIS's limit is 16KiB (this
limit is not defined by the spec, so nothing can stop a server from
sending massive headers - sadly)
This commit is contained in:
Ali Mohammad Pur 2021-10-04 17:30:45 +03:30 committed by Andreas Kling
commit 5b185d9cb5
Notes: sideshowbarker 2024-07-18 03:04:11 +09:00

View file

@ -163,7 +163,8 @@ void Job::on_socket_connected()
if (m_state == State::InHeaders || m_state == State::Trailers) {
if (!can_read_line())
return;
auto line = read_line(PAGE_SIZE);
// There's no max limit defined on headers, but for our sanity, let's limit it to 32K.
auto line = read_line(32 * KiB);
if (line.is_null()) {
if (m_state == State::Trailers) {
// Some servers like to send two ending chunks