RequestServer is a dedicated service process that handles all network operations for Ladybird. Each WebContent process gets its own RequestServer instance to perform uploads and downloads on its behalf.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/LadybirdBrowser/ladybird/llms.txt
Use this file to discover all available pages before exploring further.
Overview
RequestServer provides network access to WebContent processes while maintaining security isolation. It handles:- HTTP and HTTPS requests
- WebSocket connections
- DNS resolution through LookupServer
- HTTP disk caching
- TLS/SSL certificate management
- Resource substitution for testing
WebContent processes cannot directly access the network. All network operations must go through RequestServer for security.
Architecture
RequestServer acts as a proxy between WebContent and the network, implementing a client-server IPC model.Key components
ConnectionFromClient
Manages IPC connections from WebContent processes. Handles multiple request types:- Standard HTTP/HTTPS requests
- WebSocket connections
- Cache operations
- DNS configuration
Services/RequestServer/ConnectionFromClient.h:22
Request
Represents an individual HTTP request with:- Request method (GET, POST, etc.)
- Headers and body
- Response handling
- Progress tracking
Services/RequestServer/Request.h
Resolver
Handles DNS lookups by communicating with the system’s LookupServer service.RequestServer asks LookupServer for DNS resolution rather than doing lookups directly.
CURL integration
RequestServer uses libcurl for HTTP operations:- Multi-handle for concurrent requests
- Event-based I/O with notifiers
- Custom callbacks for socket and timeout events
Services/RequestServer/ConnectionFromClient.h:70
Process spawning
RequestServer is spawned by WebContent when needed:- WebContent creates RequestServer on initialization
- Communication occurs over IPC sockets
- Multiple WebContent processes = multiple RequestServer processes
HTTP disk cache
RequestServer supports optional disk caching for HTTP resources:Cache modes
| Mode | Description |
|---|---|
disabled | No caching (default) |
enabled | Standard HTTP cache behavior |
partitioned | Cache partitioned by site for privacy |
testing | Temporary cache for tests |
--http-disk-cache-mode flag:
Cache operations
The cache supports:- Size estimation by access time
- Bulk removal of cached entries
- Respect for HTTP cache headers
- Partitioning by origin for privacy
WebSocket support
RequestServer manages WebSocket connections throughWebSocketImplCurl:
- Full duplex communication
- Binary and text frames
- Connection management
- TLS support for secure WebSockets (wss://)
Services/RequestServer/ConnectionFromClient.h:65
Resource substitution
For testing, RequestServer can substitute local files for network resources:--resource-map flag:
Security features
Sandboxing
RequestServer runs with limited privileges:- Separate unprivileged user
- Restricted system calls via
pledge() - Limited filesystem access via
unveil() - Cannot spawn other processes
Certificate management
Supports custom TLS certificates:Configuration options
| Option | Description |
|---|---|
--certificate | Path to TLS certificate file |
--http-disk-cache-mode | Cache mode (disabled, enabled, partitioned, testing) |
--resource-map | JSON file mapping URLs to local files |
--wait-for-debugger | Pause on startup for debugger attachment |
--mach-server-name | Mach server name (macOS only) |
Request pipeline
- Receive request: WebContent sends request via IPC
- DNS resolution: Resolve hostname through LookupServer
- Connection: Establish TCP/TLS connection
- Send request: Transmit HTTP request with headers and body
- Receive response: Stream response data back to WebContent
- Cache: Optionally store in disk cache
Proxy support
RequestServer respects proxy configuration:Cookie handling
Cookies are managed by WebContent, but RequestServer:- Includes cookies in requests as directed
- Reports received cookies back to WebContent
- Respects cookie security policies
Request revalidation
Supports HTTP cache revalidation:Services/RequestServer/ConnectionFromClient.h:40
Connection pooling
CURL handles connection reuse automatically:- Keep-alive connections
- HTTP/2 multiplexing
- Connection limits per host
Error handling
RequestServer reports various error conditions:- Network timeouts
- Connection failures
- DNS resolution errors
- TLS certificate errors
- HTTP protocol errors
Performance considerations
- Concurrent requests: Multiple requests handled simultaneously
- Async I/O: Non-blocking event-driven architecture
- Connection reuse: HTTP keep-alive and HTTP/2
- Disk cache: Reduces redundant network fetches
Related services
- WebContent: Primary client of RequestServer
- LookupServer: Global DNS resolution service
- Browser: Spawns WebContent which spawns RequestServer