Skip to main content

Module srv_http

Module srv_http 

Source
Expand description

HTTP helpers for calls to the sidecar srv. Split out of main.rs unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md §4.2).

Constants§

SHELL_CREATE_TIMEOUT 🔒
How long a Shell or PtyShell create may take: one on an SSH host the user has not allowed yet waits for their answer in a consent dialog (srv gives them two minutes), well past the client’s usual 10 s.

Functions§

describe_http_error 🔒
describe_transport_error 🔒
require_agent_env 🔒
Guard for the self-scoped agent-API verbs: they need the sidecar URL + auth key to reach it, and the caller’s block id to resolve “my own” tab/pane/window/workspace.
srv_get_json 🔒
GET a srv route and return its JSON body, with every failure described by what actually happened (#3473). reqwest’s own message for a refused connection or a timeout is only “error sending request for url (…)”, which reads like a network fault whatever the cause; and parsing the body before checking the status loses the status whenever an error body isn’t JSON. So: refused / timed out / other transport failures are told apart, the status is checked first, and an error carries srv’s own error message, else the raw body.
srv_post_json 🔒
POST a JSON body to a srv route and return its JSON answer, failures described as srv_get_json describes them.