aboutsummaryrefslogtreecommitdiff
path: root/test/utestclnt.lua (follow)
Commit message (Collapse)AuthorAgeFilesLines
* feat(receive): add maxsize argument to bound memory usageThijs Schreijer2026-07-301-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* refactor: Address issues raised by linterThijs Schreijer2022-03-191-34/+34
|
* Unix domain tests still broken.Diego Nehab2013-05-301-5/+5
|
* remove uses of arg in the codebasePierre Chapuis2013-01-231-4/+4
|
* Saving before big changes to support IPv6.Diego Nehab2011-05-251-1/+1
|
* Forward server working on Mac OS X...Diego Nehab2005-02-081-0/+644