소스 검색

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)
Ali Mohammad Pur 3 년 전
부모
커밋
5b185d9cb5
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      Userland/Libraries/LibHTTP/Job.cpp

+ 2 - 1
Userland/Libraries/LibHTTP/Job.cpp

@@ -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