| 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
|
| |
|
|
| |
sink depending on response
|
| | |
|
| | |
|
| | |
|
| |\
| |
| | |
feat(url): classify host as name/ipv4/ipv6 in parse and build
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
The Host header must wrap an IPv6 literal in brackets (RFC 7230), but
adjustheaders() used reqt.host as-is, which is unbracketed after
url.parse(). Use url.classify_host() to detect IPv6 and bracket it,
handling an already-bracketed input without doubling the brackets.
Closes #445
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |\ \
| | |
| | | |
Fix/http size protect
|
| | | |
| | |
| | |
| | |
| | | |
fixes unbounded reads when using the "*l" pattern. Typically on
headers and other control lines.
|
| | | | |
|
| |\ \ \
| | | |
| | | | |
feat(headers): dynamically create cononicalized headers
|
| | | | |
| | | |
| | | | |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
| | | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | | |
Instead of a static list dynamically add entries in proper casing.
Also allowing to add non-standard ones through `setcanonic`.
closes #442
fixes #440
|
| |\ \ \
| | | |
| | | | |
fix(receive): a receive 0 should immediately return, not block
|
| | | | | |
|
| | | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | | |
The fix is slightly more complex because reading from a closed
socket should still return a closed-error.
fixes: #427
fixes: https://github.com/ledgetech/lua-resty-http/pull/313
|
| |\ \ \
| | | |
| | | | |
feat(receive): add maxsize argument to bound memory usage
|
| | |/ /
| | |
| | |
| | |
| | | |
Tests to show the socket isn't left in an undetermined state due
to dataloss, since the partial results are returned to the user.
|
| | | |
| | |
| | |
| | |
| | |
| | | |
Same class of bug as the maxsize cast: a double larger than
SIZE_MAX cast to size_t is undefined behavior. Bound-check the
numeric receive pattern before the cast, and cover it with a test.
|
| | | |
| | |
| | |
| | |
| | | |
Casting a double larger than SIZE_MAX to size_t is undefined
behavior; bound-check maxsize before the cast.
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| |\ \ \
| |_|/
|/| | |
Add option for SO_EXCLUSIVEADDRUSE in Windows
|
| | | |
| | |
| | |
| | |
| | | |
Adds docs for the option, but also adds the docs for other
options present in the code but missing from the docs.
|
| | |/ |
|
| | | |
|
| | |
| |
| | |
Signed-off-by: dependabot[bot] <support@github.com>
|
| |/ |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |\
| |
| | |
Update CI
|
| | | |
|
| |/ |
|
| |\ |
|
| | | |
|
| |/ |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
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
|
| |
|
|
| |
Closes #324
|