From a300c5597e72bd6d65b8c327843e9dc519a8c4d0 Mon Sep 17 00:00:00 2001
From: Saulius Krasuckas <saulius2@gmail.com>
Date: Tue, 23 Mar 2021 21:41:17 +0200
Subject: [PATCH] libavformat/http.h: Increase HTTP_HEADERS_SIZE.
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:
https://trac.ffmpeg.org/ticket/9020#comment:1
And many server implementations support the headers up to 16k+:
https://www.geekersdigest.com/max-http-request-header-size-server-comparison/
Let's increase the buffer to 16k, it should be safe for servers.
---
libavformat/http.h | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/libavformat/http.h b/libavformat/http.h
index 5557ce9b58..bb66426a74 100644
|
a
|
b
|
|
| 24 | 24 | |
| 25 | 25 | #include "url.h" |
| 26 | 26 | |
| 27 | | #define HTTP_HEADERS_SIZE 4096 |
| | 27 | /** |
| | 28 | * Every server listed here (except Apache 2.2) seems to use ~8k or more |
| | 29 | * as default maximum size of the full HTTP header. |
| | 30 | * |
| | 31 | * Every implementation except Apaches, Tomcats and Node.js < v13.13.0 |
| | 32 | * seems to use ~16k or more. |
| | 33 | * |
| | 34 | * In any case, it should be no harm in using even larger buffers -- a |
| | 35 | * webserver would just refuse the request with 400 or 413: |
| | 36 | * https://www.geekersdigest.com/max-http-request-header-size-server-comparison/ |
| | 37 | */ |
| | 38 | #define HTTP_HEADERS_SIZE 16384 |
| 28 | 39 | |
| 29 | 40 | /** |
| 30 | 41 | * Initialize the authentication state based on another HTTP URLContext. |