Skip to main content

Module http

Module http 

Source
Expand description

Exposes the http runtime module.

§Examples

ⓘ
use pharos_native::runtime::http;

Structs§

HttpRequest
Owned HTTP request data used by the runtime after parsing and body capture.
ParsedHttpRequest
Minimal parsed request head returned by parse_http_request.

Constants§

PHAROS_HTTP_MAX_BODY_BYTES
Maximum accepted size of a non-multipart request body.
PHAROS_HTTP_MAX_HEADER_BYTES
Maximum accepted size of the full HTTP request head.
PHAROS_HTTP_MAX_HEADER_LINE_BYTES
Maximum accepted size of any single HTTP header line.
PHAROS_HTTP_MAX_MULTIPART_BODY_BYTES
Maximum accepted size of a multipart request body.
PHAROS_HTTP_MAX_REQUEST_LINE_BYTES
Maximum accepted size of the request line.

Functions§

access_timestamp
Returns a stable UTC-like access timestamp in seconds.
apply_known_header
Applies the bounded set of request headers consumed by the runtime.
close_logged_file
Closes an optional log file explicitly.
compact_log_text
Compacts one log line while preserving bounded UTF-8 text.
connection_printf
Appends a formatted text fragment to a bounded connection response buffer.
contains_chunked_transfer
Returns whether a Transfer-Encoding header includes chunked.
extract_forwarded_ip
Returns the first forwarded client address when it is a valid IP literal.
extract_ip_from_peer_info
Extracts an address from peer information without trusting arbitrary text.
extract_real_ip_from_headers
Selects the real client IP from trusted forwarded headers or peer data.
free_http_request
Releases owned request buffers and removes any temporary body file.
http_status_code_from_response
Extracts a response status code from an HTTP status line.
http_status_line_from_response
Returns the complete first status line from an HTTP response.
http_status_text
Returns the canonical status line text used by the runtime for a bounded set of statuses.
is_trusted_proxy
Checks whether a direct peer address belongs to one of the configured CIDRs.
log_level_matches
Compares two configured log levels without accepting empty values.
mime_type_for_path
Returns the MIME type permitted for a static artifact path.
parse_content_length_header
Parses a decimal Content-Length header using the runtime’s non-negative bounds.
parse_http_request
Parses a bounded HTTP request head without accepting folded or malformed headers.
parse_ip_to_uint32
Parses an IPv4 address into its network-order integer representation.
request_headers_with_client_ip
Returns request headers with a validated client-address line appended.
request_path_without_query
Removes query and fragment data from a request target.
request_real_ip
Returns a client address selected from the request’s trusted proxy context.
resolved_error_report_path
Resolves the configured error report path, restricting relative paths to the app root.
send_text_response
Builds a text response wire representation with a bounded body.
sensitive_headers_mask
Performs sensitive headers mask.
sensitive_headers_redact
Redacts sensitive request headers before they enter an access log.
win_gettimeofday
Returns the current wall-clock time in microseconds since the Unix epoch.
write_error_report
Writes one structured error report as an append-only JSONL record.
write_temp_body_chunk
Writes one bounded body chunk, retrying short writes without invoking external code.