mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
RequestServer: Send empty headers in requests
This commit is contained in:
committed by
Ali Mohammad Pur
parent
4966fa4aed
commit
6b661a91c6
@@ -433,6 +433,18 @@ void ConnectionFromClient::start_request(i32 request_id, ByteString const& metho
|
|||||||
curl_headers = curl_slist_append(curl_headers, "Content-Type:");
|
curl_headers = curl_slist_append(curl_headers, "Content-Type:");
|
||||||
|
|
||||||
for (auto const& header : request_headers.headers()) {
|
for (auto const& header : request_headers.headers()) {
|
||||||
|
if (header.value.is_empty()) {
|
||||||
|
// Special case for headers with an empty value. curl will discard the header unless we pass the
|
||||||
|
// header name followed by a semicolon.
|
||||||
|
//
|
||||||
|
// i.e. we need to pass "Content-Type;" instead of "Content-Type: "
|
||||||
|
//
|
||||||
|
// See: https://curl.se/libcurl/c/httpcustomheader.html
|
||||||
|
auto header_string = ByteString::formatted("{};", header.name);
|
||||||
|
curl_headers = curl_slist_append(curl_headers, header_string.characters());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
auto header_string = ByteString::formatted("{}: {}", header.name, header.value);
|
auto header_string = ByteString::formatted("{}: {}", header.name, header.value);
|
||||||
curl_headers = curl_slist_append(curl_headers, header_string.characters());
|
curl_headers = curl_slist_append(curl_headers, header_string.characters());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user