From b8b263d9c3d6c8926270f10ce3f21cd3b1080d05 Mon Sep 17 00:00:00 2001 From: Luke Wilde Date: Sat, 5 Nov 2022 04:02:41 +0000 Subject: [PATCH] LibHTTP: Always send Content-Length header in POST requests Required by Google services, Content-Length should always been sent, even when there is no body. --- Userland/Libraries/LibHTTP/HttpRequest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibHTTP/HttpRequest.cpp b/Userland/Libraries/LibHTTP/HttpRequest.cpp index baa26d22d9..27abbd91ad 100644 --- a/Userland/Libraries/LibHTTP/HttpRequest.cpp +++ b/Userland/Libraries/LibHTTP/HttpRequest.cpp @@ -67,7 +67,7 @@ ByteBuffer HttpRequest::to_raw_request() const builder.append(header.value); builder.append("\r\n"sv); } - if (!m_body.is_empty()) { + if (!m_body.is_empty() || method() == Method::POST) { builder.appendff("Content-Length: {}\r\n\r\n", m_body.size()); builder.append((char const*)m_body.data(), m_body.size()); }