mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibHTTP+LibWeb+RequestServer: Move Fetch's HTTP header infra to LibHTTP
The end goal here is for LibHTTP to be the home of our RFC 9111 (HTTP caching) implementation. We currently have one implementation in LibWeb for our in-memory cache and another in RequestServer for our disk cache. The implementations both largely revolve around interacting with HTTP headers. But in LibWeb, we are using Fetch's header infra, and in RS we are using are home-grown header infra from LibHTTP. So to give these a common denominator, this patch replaces the LibHTTP implementation with Fetch's infra. Our existing LibHTTP implementation was not particularly compliant with any spec, so this at least gives us a standards-based common implementation. This migration also required moving a handful of other Fetch AOs over to LibHTTP. (It turns out these AOs were all from the Fetch/Infra/HTTP folder, so perhaps it makes sense for LibHTTP to be the implementation of that entire set of facilities.)
This commit is contained in:
parent
3dce6766a3
commit
9375660b64
Notes:
github-actions[bot]
2025-11-27 13:58:52 +00:00
Author: https://github.com/trflynn89
Commit: 9375660b64
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6944
Reviewed-by: https://github.com/gmta ✅
78 changed files with 935 additions and 1017 deletions
|
|
@ -39,7 +39,7 @@ WebIDL::ExceptionOr<bool> NavigatorBeaconPartial::send_beacon(String const& url,
|
|||
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, MUST(String::formatted("Beacon URL {} must be either http:// or https://.", url)) };
|
||||
|
||||
// 4. Let headerList be an empty list.
|
||||
auto header_list = Fetch::Infrastructure::HeaderList::create(vm);
|
||||
auto header_list = HTTP::HeaderList::create();
|
||||
|
||||
// 5. Let corsMode be "no-cors".
|
||||
auto cors_mode = Fetch::Infrastructure::Request::Mode::NoCORS;
|
||||
|
|
@ -62,7 +62,7 @@ WebIDL::ExceptionOr<bool> NavigatorBeaconPartial::send_beacon(String const& url,
|
|||
cors_mode = Fetch::Infrastructure::Request::Mode::CORS;
|
||||
|
||||
// If contentType value is a CORS-safelisted request-header value for the Content-Type header, set corsMode to "no-cors".
|
||||
auto content_type_header = Fetch::Infrastructure::Header::isomorphic_encode("Content-Type"sv, content_type.value());
|
||||
auto content_type_header = HTTP::Header::isomorphic_encode("Content-Type"sv, content_type.value());
|
||||
if (Fetch::Infrastructure::is_cors_safelisted_request_header(content_type_header))
|
||||
cors_mode = Fetch::Infrastructure::Request::Mode::NoCORS;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue