![]() |
Retro Rocket OS
|
The HTTP library provides simple URL parsing helpers and minimal client-side HTTP request routines (HTTP/1.0 with Connection: close).
Responses are stored internally as chunked data to avoid string size limits. The response is split into headers and body after receipt. The body is exposed as a sequence of chunks rather than a single concatenated string.
The following publicly documented procedures and functions are available via this library.
Return the scheme (e.g. http, https, ws, wss, ftp) or an empty string if none.
Return the fragment (text after #) or an empty string if none.
Return the query string (text after ?, excluding #…) or an empty string if none.
Return the path component beginning with /. Returns / for bare hosts and an empty string if not applicable.
Return the host portion of the authority. Supports IPv4/hostnames and bracketed IPv6. Returns an empty string if not present.
Return the explicit port if present; otherwise the default for the scheme (http/ws=80, https/wss=443, ftp=21). Returns 0 if no scheme is recognised and no explicit port is present.
Look up a single query parameter value by name. Returns the value if present, an empty string if the key appears with no value, or an empty string if the key is absent.
Perform a GET request to url$.
Perform a HEAD request. Only headers are expected; body may be empty.
Perform a POST with postdata$ as the raw request body. Content-Length is set automatically.
Perform a PUT with putdata$ as the raw request body.
Perform a PATCH with patchdata$ as the raw request body.
Perform a DELETE request.
Low-level entry point used by the above helpers. Builds the request line and minimal headers (Host, Connection: close, optional Content-Length) and sends the request over HTTP, or HTTPS when the scheme/port implies HTTPS.
The full response is received in chunks and internally split into headers and body.
Return a structured portion of the most recent response.
Both are MAP-backed collections:
These maps should be treated as read-only.
Return string-based response data. part$ must be one of:
Returns an empty string if no response is available or the requested value does not exist.
Frees MAPs used by the result. You should call this after you are finished with any result.
Returns TRUE if the last HTTP request returned a valid response
Returns TRUE if the last HTTP request had a body part
The response body is not returned as a single string. Instead, iterate over chunks:
This allows handling arbitrarily large responses without exceeding string limits.
This performs a simple GET, prints the numeric status code, then streams the body safely.