mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
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.)
34 lines
1.6 KiB
Text
34 lines
1.6 KiB
Text
#include <LibCore/Proxy.h>
|
|
#include <LibHTTP/Header.h>
|
|
#include <LibURL/URL.h>
|
|
#include <RequestServer/CacheLevel.h>
|
|
|
|
endpoint RequestServer
|
|
{
|
|
init_transport(int peer_pid) => (int peer_pid)
|
|
connect_new_client() => (IPC::File client_socket)
|
|
connect_new_clients(size_t count) => (Vector<IPC::File> sockets)
|
|
|
|
// use_tls: enable DNS over TLS
|
|
set_dns_server(ByteString host_or_address, u16 port, bool use_tls, bool validate_dnssec_locally) =|
|
|
set_use_system_dns() =|
|
|
|
|
// Test if a specific protocol is supported, e.g "http"
|
|
is_supported_protocol(ByteString protocol) => (bool supported)
|
|
|
|
start_request(i32 request_id, ByteString method, URL::URL url, Vector<HTTP::Header> request_headers, ByteBuffer request_body, Core::ProxyData proxy_data) =|
|
|
stop_request(i32 request_id) => (bool success)
|
|
set_certificate(i32 request_id, ByteString certificate, ByteString key) => (bool success)
|
|
|
|
ensure_connection(URL::URL url, ::RequestServer::CacheLevel cache_level) =|
|
|
|
|
estimate_cache_size_accessed_since(u64 cache_size_estimation_id, UnixDateTime since) =|
|
|
remove_cache_entries_accessed_since(UnixDateTime since) =|
|
|
|
|
// Websocket Connection API
|
|
websocket_connect(i64 websocket_id, URL::URL url, ByteString origin, Vector<ByteString> protocols, Vector<ByteString> extensions, Vector<HTTP::Header> additional_request_headers) =|
|
|
websocket_send(i64 websocket_id, bool is_text, ByteBuffer data) =|
|
|
websocket_close(i64 websocket_id, u16 code, ByteString reason) =|
|
|
websocket_set_certificate(i64 request_id, ByteString certificate, ByteString key) => (bool success)
|
|
|
|
}
|