Skip to main content
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.

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
Located in Services/RequestServer/ConnectionFromClient.h:22

Request

Represents an individual HTTP request with:
  • Request method (GET, POST, etc.)
  • Headers and body
  • Response handling
  • Progress tracking
Located in 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
Located in 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
Each WebContent process maintains its own RequestServer instance for isolation.

HTTP disk cache

RequestServer supports optional disk caching for HTTP resources:

Cache modes

Enable caching with the --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 through WebSocketImplCurl:
Features:
  • Full duplex communication
  • Binary and text frames
  • Connection management
  • TLS support for secure WebSockets (wss://)
Located in Services/RequestServer/ConnectionFromClient.h:65

Resource substitution

For testing, RequestServer can substitute local files for network resources:
Use with --resource-map flag:
Resource substitution is useful for offline testing and avoiding external dependencies in test suites.

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:
Certificates can be set per-request or globally.

Configuration options

Request pipeline

  1. Receive request: WebContent sends request via IPC
  2. DNS resolution: Resolve hostname through LookupServer
  3. Connection: Establish TCP/TLS connection
  4. Send request: Transmit HTTP request with headers and body
  5. Receive response: Stream response data back to WebContent
  6. Cache: Optionally store in disk cache

Proxy support

RequestServer respects proxy configuration:
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:
Located in 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
  • WebContent: Primary client of RequestServer
  • LookupServer: Global DNS resolution service
  • Browser: Spawns WebContent which spawns RequestServer