From b9263d810ca4ab3c59d5fbbee15309d075b993dd Mon Sep 17 00:00:00 2001
From: Saulius Krasuckas <saulius2@gmail.com>
Date: Tue, 23 Mar 2021 21:41:17 +0200
Subject: [PATCH] avformat/http: Increase HTTP_HEADERS_SIZE
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This is continuation of d29c42974487d5fa0a5c1b05a09da5c5818ab63e.

As of early 2021, real world cases (ytdl + Microsoft Stream) may
carry almost 10k in an HTTP request header thus breaking FFmpeg.

Every server listed here [1] (except Apache 2.2) seems to use ~8k or more
as default maximum size of the full HTTP header.

Every implementation except Apache’s, Tomcat’s and Node.js < v13.13.0
seems to use ~16k or more.

In any case, it should be no harm in using even larger buffers –
a webserver would just refuse the request with 400 or 413.

[1]: https://www.geekersdigest.com/max-http-request-header-size-server-comparison/

Fixes https://trac.ffmpeg.org/ticket/9020.
---
 libavformat/http.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/http.h b/libavformat/http.h
index 5557ce9b58..cd06b6dc47 100644
--- a/libavformat/http.h
+++ b/libavformat/http.h
@@ -24,7 +24,7 @@
 
 #include "url.h"
 
-#define HTTP_HEADERS_SIZE 4096
+#define HTTP_HEADERS_SIZE 16384
 
 /**
  * Initialize the authentication state based on another HTTP URLContext.
-- 
2.27.0

