Skip to content

Truly independent web browser

2.7 KB
Raw Blame
#include <LibCore/AnonymousBuffer.h>
#include <LibHTTP/Cache/CacheMode.h>
#include <LibHTTP/Cookie/Cookie.h>
#include <LibHTTP/Cookie/IncludeCredentials.h>
#include <LibHTTP/Header.h>
#include <LibHTTP/NetworkIsolationKey.h>
#include <LibRequests/ExportedRequest.h>
#include <LibURL/URL.h>
#include <RequestServer/CacheLevel.h>
#include <RequestServer/IsPrivate.h>
#include <RequestServer/RequestType.h>

endpoint RequestServer
{

    // Test if a specific protocol is supported, e.g "http"
    is_supported_protocol(ByteString protocol) => (bool supported)
    get_client_id() => (int client_id)

    start_request(u64 request_id, ByteString method, URL::URL url, Vector<HTTP::Header> request_headers, ByteBuffer request_body, HTTP::CacheMode cache_mode, Optional<HTTP::NetworkIsolationKey> network_isolation_key, HTTP::Cookie::IncludeCredentials include_credentials, bool create_transfer_lease, Optional<u32> address_selection_hint, bool notify_on_cache_miss, u64 originating_page_id, HTTP::Cookie::SameSiteContext same_site_context) =|
    // owner_client_id: the client a UI process client expects to hold the lease
    adopt_request(int source_client_id, u64 source_request_id, u64 target_request_id, bool preserve_transfer_lease, Optional<int> owner_client_id) =|
    release_request_transfer_lease(int source_client_id, u64 source_request_id) =|
    stop_request(u64 request_id) => (bool success)

    // Only the UI process's own clients move responses between RequestServers: a response fetched by one site's
    // RequestServer is exported from it and imported into the RequestServer of the site that navigates to it.
    export_request(u64 request_id) => (Optional<Requests::ExportedRequest> exported_request)
    import_request(u64 request_id, Requests::ExportedRequest exported_request, bool create_transfer_lease) =|

    ensure_connection(u64 request_id, URL::URL url, ::RequestServer::CacheLevel cache_level) =|

    // Looks up a host that something other than a request connects to, such as a WebRTC ICE server, so that the
    // browser's DNS settings apply to it too.
    resolve_host(u64 lookup_id, ByteString host) =|

    // Websocket Connection API
    websocket_connect(u64 websocket_id, URL::URL url, Optional<HTTP::NetworkIsolationKey> network_isolation_key, ByteString origin, Vector<ByteString> protocols, Vector<ByteString> extensions, Vector<HTTP::Header> additional_request_headers, u64 originating_page_id, HTTP::Cookie::SameSiteContext same_site_context) =|
    websocket_send(u64 websocket_id, bool is_text, ByteBuffer data) =|
    websocket_send_shared(u64 websocket_id, bool is_text, Core::AnonymousBuffer data) =|
    websocket_close(u64 websocket_id, u16 code, ByteString reason) =|

}