std/net/tls
TLS bindings — the encrypted transport behind an https:// URL.
Bound with @link(symbol = …) against axle_tls, a staticlib of its own. That
separation is what keeps TLS off a program that does not ask for it: the
archive is on every link line, and the linker includes objects, not
archives, so naming none of these symbols links none of the stack.
Nothing here raises. Every binding answers a code, and the caller readstlsLastError() for the reason — the Rust side has no way to raise an
Axle exception without depending on the runtime, which would cost it its
place as a leaf.
Free functions
| Type | Method and description |
|---|---|
| tlsConnect(host : string, port : i32, timeoutMillis : i32) : i64 Open a TLS connection to host:port, answering a handle or 0.timeoutMillis bounds the connect and every later read and write; 0leaves the OS default. |
| tlsRead(handle : i64, buf : ptr, max : i32) : i32 Up to max decrypted bytes: the count, 0 at end of stream, -1 onfailure. A null buffer or a non-positive max is also -1, never 0. |
| tlsWrite(handle : i64, buf : ptr, len : i32) : i32 Encrypt and send; answers how many bytes were taken, or -1. A null bufferor a non-positive len is -1, never 0. |
| tlsClose(handle : i64) : void Send close-notify and release the handle. An unknown handle is a no-op. |
| tlsLastErrorInto(buf : ptr, max : i32) : i32 Copy this thread's last error into buf, answering its byte length. |
| tlsLastError() : string This thread's last transport error, as text. Read immediately after the call that failed: the slot is per-thread and every fallible binding clears it on entry, so a stale message can never be mistaken for this call's reason. |
Method detail
#tlsConnect
Open a TLS connection to host:port, answering a handle or 0.timeoutMillis bounds the connect and every later read and write; 0
leaves the OS default.
#tlsRead
Up to max decrypted bytes: the count, 0 at end of stream, -1 on
failure. A null buffer or a non-positive max is also -1, never 0.
#tlsWrite
Encrypt and send; answers how many bytes were taken, or -1. A null buffer
or a non-positive len is -1, never 0.
#tlsClose
Send close-notify and release the handle. An unknown handle is a no-op.
#tlsLastErrorInto
Copy this thread's last error into buf, answering its byte length.
#tlsLastError
This thread's last transport error, as text.
Read immediately after the call that failed: the slot is per-thread and
every fallible binding clears it on entry, so a stale message can never
be mistaken for this call's reason.