mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +00:00
RequestServer: Send empty headers in requests
This commit is contained in:
parent
4966fa4aed
commit
6b661a91c6
Notes:
github-actions[bot]
2025-02-17 12:44:09 +00:00
Author: https://github.com/davidmhewitt
Commit: 6b661a91c6
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3598
1 changed files with 12 additions and 0 deletions
|
@ -433,6 +433,18 @@ void ConnectionFromClient::start_request(i32 request_id, ByteString const& metho
|
|||
curl_headers = curl_slist_append(curl_headers, "Content-Type:");
|
||||
|
||||
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);
|
||||
curl_headers = curl_slist_append(curl_headers, header_string.characters());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue