mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 14:57:35 +00:00
LibWeb: Send appropriate Accept header for FrameLoader requests
According to Fetch, we must send an Accept header with the value "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" for document, iframe and frame requests. https://fetch.spec.whatwg.org/#concept-fetch Required by uber.com.
This commit is contained in:
parent
ead8ac8972
commit
b717f7065e
1 changed files with 12 additions and 0 deletions
|
@ -160,6 +160,18 @@ bool FrameLoader::load(LoadRequest& request, Type type)
|
||||||
page->client().page_did_start_loading(url);
|
page->client().page_did_start_loading(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://fetch.spec.whatwg.org/#concept-fetch
|
||||||
|
// Step 12: If request’s header list does not contain `Accept`, then:
|
||||||
|
// 1. Let value be `*/*`. (NOTE: Not necessary as we're about to override it)
|
||||||
|
// 2. A user agent should set value to the first matching statement, if any, switching on request’s destination:
|
||||||
|
// -> "document"
|
||||||
|
// -> "frame"
|
||||||
|
// -> "iframe"
|
||||||
|
// `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8`
|
||||||
|
// FIXME: This should be case-insensitive.
|
||||||
|
if (!request.headers().contains("Accept"))
|
||||||
|
request.set_header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
|
||||||
|
|
||||||
set_resource(ResourceLoader::the().load_resource(Resource::Type::Generic, request));
|
set_resource(ResourceLoader::the().load_resource(Resource::Type::Generic, request));
|
||||||
|
|
||||||
if (type == Type::IFrame)
|
if (type == Type::IFrame)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue