From 339ae7873e788e7f52e6277ef8e76c5afde568a8 Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Wed, 14 Apr 2021 09:20:25 +0430 Subject: LibHTTP: Trim the whitespace around the Transfer-Encoding header value Fixes #6302. --- Userland/Libraries/LibHTTP/Job.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Userland') diff --git a/Userland/Libraries/LibHTTP/Job.cpp b/Userland/Libraries/LibHTTP/Job.cpp index 0a06eed32a..e41cd7d3a3 100644 --- a/Userland/Libraries/LibHTTP/Job.cpp +++ b/Userland/Libraries/LibHTTP/Job.cpp @@ -288,7 +288,8 @@ void Job::on_socket_connected() } else { auto transfer_encoding = m_headers.get("Transfer-Encoding"); if (transfer_encoding.has_value()) { - auto encoding = transfer_encoding.value(); + // Note: Some servers add extra spaces around 'chunked', see #6302. + auto encoding = transfer_encoding.value().trim_whitespace(); dbgln_if(JOB_DEBUG, "Job: This content has transfer encoding '{}'", encoding); if (encoding.equals_ignoring_case("chunked")) { -- cgit v1.2.3