HTTP request handling
HttpRequest
Build and send HTTP requests:HTTP methods
Supported HTTP methods:GET
Retrieve resource
POST
Submit data
PUT
Update resource
DELETE
Remove resource
HEAD
Get headers only
OPTIONS
Query supported methods
PATCH
Partial update
TRACE
Diagnostic trace
CONNECT
Establish tunnel
Parsing requests
Parse raw HTTP requests:Header management
HeaderList
Manage HTTP headers:Header parsing
HTTP status codes
Status handling
Status codes follow the HTTP/1.1 specification (RFC 7231). LibHTTP provides the
Status enum for common status codes.Request building patterns
GET request
POST with JSON
Form data submission
Cookie handling
LibHTTP includes cookie support for maintaining session state:Setting cookies
Cookie attributes
Domain- Cookie domain scopePath- URL path scopeExpires- Expiration timestampMax-Age- Lifetime in secondsSecure- HTTPS onlyHttpOnly- No JavaScript accessSameSite- CSRF protection (Strict/Lax/None)
Caching
HTTP cache support
LibHTTP supports HTTP caching directives:Cache directives
Cache-Control
no-cache, no-store, max-age, must-revalidateETag
Entity tag for conditional requests
Last-Modified
Resource modification timestamp
Expires
Explicit expiration date
Content negotiation
Accept headers
Content-Type parsing
Integration with RequestServer
LibHTTP typically works through RequestServer for actual network I/O:Utilities
URL handling
LibHTTP works withURL::URL from LibURL:
Method conversion
Error handling
Advanced features
Custom headers
Range requests
Performance considerations
Source location
- Repository:
~/workspace/source/Libraries/LibHTTP/ - Key headers:
HttpRequest.h,HeaderList.h,Header.h,Status.h,Method.h - Cookie support:
LibHTTP/Cookie/ - Caching:
LibHTTP/Cache/
LibHTTP implements HTTP/1.1 per RFC 7230-7235. HTTP/2 and HTTP/3 support is planned for future releases.