Files
ladybird/Services/RequestServer/RequestClient.ipc
Timothy Flynn e6c008a269 LibWeb+RequestServer: Attach HTTP cookie headers from RequestServer
We currently attach HTTP cookie headers from LibWeb within Fetch. This
has the downside that the cookie IPC, and the infrastructure around it,
are all synchronous. This blocks the WebContent process entirely while
the cookie is being retrieved, for every request on a page.

We now attach cookie headers from RequestServer. The state machine in
RequestServer::Request allows us to easily do this work asynchronously.
We can also skip this work entirely when the response is served from
disk cache.

Note that we will continue to parse cookies in the WebContent process.
If something goes awry during parsing. we limit the damage to that
process, instead of the UI or RequestServer.

Also note that WebSocket requests still have cookie headers attached
attached from LibWeb. This will be handled in a future patch.

In the future, we may want to introduce a memory cache for cookies in
RequestServer to avoid IPC altogether as able.
2026-02-10 12:21:20 +01:00

30 lines
1.3 KiB
Plaintext

#include <LibHTTP/Header.h>
#include <LibRequests/CacheSizes.h>
#include <LibRequests/NetworkError.h>
#include <LibRequests/RequestTimingInfo.h>
#include <LibURL/URL.h>
endpoint RequestClient
{
request_started(u64 request_id, IPC::File fd) =|
request_finished(u64 request_id, u64 total_size, Requests::RequestTimingInfo timing_info, Optional<Requests::NetworkError> network_error) =|
headers_became_available(u64 request_id, Vector<HTTP::Header> response_headers, Optional<u32> status_code, Optional<String> reason_phrase) =|
retrieve_http_cookie(int client_id, u64 request_id, URL::URL url) =|
// Websocket API
// FIXME: See if this can be merged with the regular APIs
websocket_connected(u64 websocket_id) =|
websocket_received(u64 websocket_id, bool is_text, ByteBuffer data) =|
websocket_errored(u64 websocket_id, i32 message) =|
websocket_closed(u64 websocket_id, u16 code, ByteString reason, bool clean) =|
websocket_ready_state_changed(u64 websocket_id, u32 ready_state) =|
websocket_subprotocol(u64 websocket_id, ByteString subprotocol) =|
websocket_certificate_requested(u64 websocket_id) =|
// Certificate requests
certificate_requested(u64 request_id) =|
estimated_cache_size(u64 cache_size_estimation_id, Requests::CacheSizes sizes) =|
}