Module
Module documentation.
modulenet.http
Classes
Classes and inheritance.
Functions
Free functions and class methods.
functionnet.http::__http_recv_all_tcp
Signature
extern func __http_recv_all_tcp(fd: Int, max_total: Int, timeout_ms: Int) -> String;extern func __http_recv_all_tcp(fd: Int, max_total: Int, timeout_ms: Int) -> String;
/*
@brief Binds the low-level runtime symbol `__http_recv_all_tls`.@briefBinds the low-level runtime symbol `__http_recv_all_tcp`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- fdOperating-system file descriptor or socket descriptor.
- max_totalMaximum allowed count or byte size.
- timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnReturns the operation result as `String`.
functionnet.http::__http_recv_all_tls
Signature
extern func __http_recv_all_tls(h: Int, max_total: Int, timeout_ms: Int) -> String;extern func __http_recv_all_tls(h: Int, max_total: Int, timeout_ms: Int) -> String;
/*@briefBinds the low-level runtime symbol `__http_recv_all_tls`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
- max_totalMaximum allowed count or byte size.
- timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnReturns the operation result as `String`.
functionnet.http::http_recv_all_tcp
Signature
func http_recv_all_tcp(fd: Int, max_total: Int, timeout_ms: Int) -> Stringfunc http_recv_all_tcp(fd: Int, max_total: Int, timeout_ms: Int) -> String {
return __http_recv_all_tcp(fd, max_total, timeout_ms);
}@briefProvides the system library operation `http_recv_all_tcp`.
@detailsExecutes the `http_recv_all_tcp` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fdOperating-system file descriptor or socket descriptor.
- max_totalMaximum allowed count or byte size.
- timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnReturns the operation result as `String`.
functionnet.http::http_recv_all_tls
Signature
func http_recv_all_tls(h: Int, max_total: Int, timeout_ms: Int) -> Stringfunc http_recv_all_tls(h: Int, max_total: Int, timeout_ms: Int) -> String {
return __http_recv_all_tls(h, max_total, timeout_ms);
}@briefProvides the system library operation `http_recv_all_tls`.
@detailsExecutes the `http_recv_all_tls` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- hUnderlying runtime handle.
- max_totalMaximum allowed count or byte size.
- timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnReturns the operation result as `String`.
functionnet.http::find_substr_from
Signature
func find_substr_from(s: String, pat: String, start: Int) -> Intfunc find_substr_from(s: String, pat: String, start: Int) -> Int {
let n: Int = std.len(s);
let m: Int = std.len(pat);@briefFinds a matching position or element with `find_substr_from`.
@detailsExecutes the `find_substr_from` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- patPattern string used for matching keys, text, routes, or protocol fields.
- startZero-based starting index, byte offset, or range boundary for the operation.
@returnReturns the operation result as `Int`.
functionnet.http::find_substr
Signature
func find_substr(s: String, pat: String) -> Intfunc find_substr(s: String, pat: String) -> Int {
return find_substr_from(s, pat, 0);
}@briefFinds a matching position or element with `find_substr`.
@detailsExecutes the `find_substr` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- patPattern string used for matching keys, text, routes, or protocol fields.
@returnReturns the operation result as `Int`.
functionnet.http::decode_chunked
Signature
func decode_chunked(body: String) -> Stringfunc decode_chunked(body: String) -> String {
let out: String = "";
let i: Int = 0;@briefDecodes input data with `decode_chunked`.
@detailsExecutes the `decode_chunked` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- bodyRequest or response body content carried by the protocol message.
@returnReturns the operation result as `String`.
functionnet.http::header_value
Signature
func header_value(headers_lc: String, key_lc: String) -> Stringfunc header_value(headers_lc: String, key_lc: String) -> String {
let key: String = key_lc + ":";
let p: Int = find_substr(headers_lc, key);@briefProvides the system library operation `header_value`.
@detailsExecutes the `header_value` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- headers_lcHeader map keyed by lower-case header names for case-insensitive lookup.
- key_lcKey name, key material, or key collection used by the operation.
@returnReturns the operation result as `String`.
functionnet.http::response_body
Signature
func response_body(resp: String) -> Stringfunc response_body(resp: String) -> String {
let sep: Int = find_substr(resp, "\r\n\r\n");
if sep < 0 {@briefProvides the system library operation `response_body`.
@detailsExecutes the `response_body` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- respResponse object or encoded response payload processed by the operation.
@returnReturns the operation result as `String`.
functionnet.http::request
Signature
func request(method: String, raw_url: String, data: String) -> String, ErrCodefunc request(method: String, raw_url: String, data: String) -> String, ErrCode {
let u: net.url.URL = net.url.parse(raw_url)?;
let path: String = u.path;@briefProvides the system library operation `request`.
@detailsExecutes the `request` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- methodHTTP method or dispatch method name used by the operation.
- raw_urlURL string exactly as supplied by the caller before parsing or escaping.
- dataInput or output data buffer.
@returnReturns `String, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.http::get
Signature
func get(raw_url: String) -> String, ErrCodefunc get(raw_url: String) -> String, ErrCode {
return request("GET", raw_url, "");
}@briefReads the element for `get`.
@detailsExecutes the `get` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- raw_urlURL string exactly as supplied by the caller before parsing or escaping.
@returnReturns `String, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.http::post
Signature
func post(raw_url: String, data: String) -> String, ErrCodefunc post(raw_url: String, data: String) -> String, ErrCode {
return request("POST", raw_url, data);
}@briefProvides the system library operation `post`.
@detailsExecutes the `post` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- raw_urlURL string exactly as supplied by the caller before parsing or escaping.
- dataInput or output data buffer.
@returnReturns `String, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
Variables
Class fields (var).