| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
| |
convention
Rename response_headers to headers_callback, pass the raw connection as a
4th argument (for use cases like WebSocket upgrade handoff), and switch its
return contract to the idiomatic ok/err shape used elsewhere in this file:
truthy ok continues (optionally swapping in a new sink), falsy ok closes the
connection and propagates the callback's error via socket.protect instead of
faking a success return.
Claude-Session: https://claude.ai/code/session_01S4imKCU4hxDg96DXj9hxSB
|
| | |
|
| |\
| |
| | |
feat(url): classify host as name/ipv4/ipv6 in parse and build
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
parse() now sets hosttype ("name"/"ipv4"/"ipv6") plus a matching
hostname/ipv4/ipv6 field alongside host. build() accepts those same
fields when host is absent, erroring if more than one is set.
classify_host is exported for standalone use; it classifies by shape
(colon present -> ipv6, dotted-quad shape -> ipv4) rather than
validating the address.
|
| |\ \
| | |
| | | |
feat(headers): dynamically create cononicalized headers
|
| | |/
| |
| |
| |
| |
| |
| |
| | |
Instead of a static list dynamically add entries in proper casing.
Also allowing to add non-standard ones through `setcanonic`.
closes #442
fixes #440
|
| |\ \
| | |
| | | |
feat(receive): add maxsize argument to bound memory usage
|
| | | | |
|
| | |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
client:receive("*l") and receive("*a") are unbounded: a peer that never
sends a newline, or never closes, makes LuaSocket buffer until the
process runs out of memory (e.g. src/http.lua reading response headers
in a loop). Add an optional maxsize argument that caps the payload a
single call may accumulate, including prefix.
- Hoist all argument validation ahead of timeout_markstart() so bad
calls (maxsize < 1, #prefix >= maxsize, numeric pattern > maxsize)
raise before any I/O and leave the socket untouched.
- recvline/recvall take a budget and return a new internal
BUF_OVERSIZED code, surfaced to Lua as the "oversized" error
alongside "timeout"/"closed", with the partial held in the 3rd
return value.
- recvraw is left untouched: argument checks make the cap unreachable
for numeric patterns.
- Preserve three invariants: a timeout partial is always shorter than
maxsize (safe to retry as prefix), completion beats the cap for *a,
and no bytes are lost or skipped on overflow.
- tcp.c, unixstream.c and serial.c all share this code path unchanged.
Adds test coverage (argument errors, *l/*a boundaries, timeout/close
at the cap, the drain idiom, numeric patterns, unix-stream mirror) and
documents the new argument, error, and recovery idioms in docs/tcp.html.
|
| |/
|
|
|
| |
Adds docs for the option, but also adds the docs for other
options present in the code but missing from the docs.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
Many editors remove these automatically anyway which makes opening and
editng the docs cause a bunch of noise. This is just to get the noise
out of the way in a style commit so it doesn't leak into other PRs
|
| |
|
|
| |
Closes #401
|
| |\ |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| | |
This makes it so that a listening socket does not become readable for
accept() until a connection has been fully established *and* started
sending something, thus the program doesn't have to wait for the first
data. This only makes sense for client-speaks-first protocols.
Co-authored-by: Caleb Maclennan <caleb@alerque.com>
|
| |/ |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|