mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +00:00
LibWeb: Add Referer HTTP header to CSS font requests
If we don't do this, we just get 404 Not Found for all fonts used by https://apple.com/
This commit is contained in:
parent
d730cd89f5
commit
e924ea002f
Notes:
sideshowbarker
2024-07-17 09:49:48 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/e924ea002f Pull-request: https://github.com/SerenityOS/serenity/pull/20762
1 changed files with 8 additions and 0 deletions
|
@ -71,6 +71,7 @@
|
|||
#include <LibWeb/Layout/Node.h>
|
||||
#include <LibWeb/Loader/ResourceLoader.h>
|
||||
#include <LibWeb/Platform/FontPlugin.h>
|
||||
#include <LibWeb/ReferrerPolicy/AbstractOperations.h>
|
||||
#include <stdio.h>
|
||||
|
||||
namespace AK {
|
||||
|
@ -148,6 +149,13 @@ private:
|
|||
return;
|
||||
LoadRequest request;
|
||||
request.set_url(m_urls.take_first());
|
||||
|
||||
// HACK: We're crudely computing the referer value and shoving it into the
|
||||
// request until fetch infrastructure is used here.
|
||||
auto referrer_url = ReferrerPolicy::strip_url_for_use_as_referrer(m_style_computer.document().url());
|
||||
if (referrer_url.has_value() && !request.headers().contains("Referer"))
|
||||
request.set_header("Referer", referrer_url->serialize());
|
||||
|
||||
set_resource(ResourceLoader::the().load_resource(Resource::Type::Generic, request));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue