LibWeb: Support sending DNT header with requests

This commit is contained in:
Jamie Mansfield 2024-07-02 20:29:43 +01:00 committed by Andreas Kling
commit fb20326979
Notes: sideshowbarker 2024-07-17 07:14:09 +09:00
7 changed files with 22 additions and 0 deletions

View file

@ -1689,6 +1689,10 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_network_or_cache_fet
// NOTE: `Accept` and `Accept-Language` are already included (unless fetch() is used, which does not include
// the latter by default), and `Accept-Charset` is a waste of bytes. See HTTP header layer division for
// more details.
if (ResourceLoader::the().enable_do_not_track() && !http_request->header_list()->contains("DNT"sv.bytes())) {
auto header = Infrastructure::Header::from_string_pair("DNT"sv, "1"sv);
http_request->header_list()->append(move(header));
}
// 21. If includeCredentials is true, then:
if (include_credentials == IncludeCredentials::Yes) {