From 8fee285d726ad4a7f6286208998dd7a70fc52732 Mon Sep 17 00:00:00 2001 From: GeekFiftyFive Date: Tue, 29 Mar 2022 19:59:06 +0100 Subject: [PATCH] LibHTTP: Append port to Host header if it exists --- Userland/Libraries/LibHTTP/HttpRequest.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Userland/Libraries/LibHTTP/HttpRequest.cpp b/Userland/Libraries/LibHTTP/HttpRequest.cpp index 5d098e8447..c63c16e33d 100644 --- a/Userland/Libraries/LibHTTP/HttpRequest.cpp +++ b/Userland/Libraries/LibHTTP/HttpRequest.cpp @@ -41,6 +41,8 @@ ByteBuffer HttpRequest::to_raw_request() const } builder.append(" HTTP/1.1\r\nHost: "); builder.append(m_url.host()); + if (m_url.port().has_value()) + builder.appendff(":{}", *m_url.port()); builder.append("\r\n"); for (auto& header : m_headers) { builder.append(header.name);