Explorar o código

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.
Luke Wilde %!s(int64=2) %!d(string=hai) anos
pai
achega
b8b263d9c3
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      Userland/Libraries/LibHTTP/HttpRequest.cpp

+ 1 - 1
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());
     }