Jelajahi Sumber

LibHTTP: Append port to Host header if it exists

GeekFiftyFive 3 tahun lalu
induk
melakukan
8fee285d72
1 mengubah file dengan 2 tambahan dan 0 penghapusan
  1. 2 0
      Userland/Libraries/LibHTTP/HttpRequest.cpp

+ 2 - 0
Userland/Libraries/LibHTTP/HttpRequest.cpp

@@ -41,6 +41,8 @@ ByteBuffer HttpRequest::to_raw_request() const
     }
     }
     builder.append(" HTTP/1.1\r\nHost: ");
     builder.append(" HTTP/1.1\r\nHost: ");
     builder.append(m_url.host());
     builder.append(m_url.host());
+    if (m_url.port().has_value())
+        builder.appendff(":{}", *m_url.port());
     builder.append("\r\n");
     builder.append("\r\n");
     for (auto& header : m_headers) {
     for (auto& header : m_headers) {
         builder.append(header.name);
         builder.append(header.name);