| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
Implements SSE by using the replacement body sink. Replaces
the sink with an SSE parser if the response is a text stream.
Example application included
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Drives socket.http.request against fully scripted, controlled raw HTTP
responses over a real socket by reusing the existing testsrvr.lua
remote-execution server -- no Apache, no Docker, no third-party hosts.
Proves the fixture with a plain-GET smoke test, a chunked-transfer-
encoding smoke test, and a test asserting a response body delivered
across separately-timed writes (the incremental-delivery capability the
upcoming SSE tests need). Wires the new test into the CI regression step.
Claude-Session: https://claude.ai/code/session_01SW789SftppghLPVXYbWsGi
|
| |\
| |
| | |
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.
|
| |\ \
| | |
| | | |
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
|
| |/ /
| |
| |
| |
| | |
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.
|
| |
|
| |
Location header can now be relative: https://httpwg.org/specs/rfc9110.html#field.location
|
| | |
|
| | |
|
| |
|
|
| |
"#!/usr/bin/env lua"
|
| |
|
|
| |
"#!/usr/bin/env lua"
|
| | |
|
| | |
|
| |\
| |
| | |
Add "tcp-keepidle", "tcp-keepcnt" and "tcp-keepintvl" options
|
| | | |
|
| | |
| |
| |
| | |
empty-segment special-case code
|
| | | |
|
| | | |
|
| | | |
|
| | |
| |
| |
| | |
case to prevent triple-dot activation and authority collision
|
| | |
| |
| |
| | |
_M.absolute() even when not merging
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| | |
test cases to test/urltest.lua
fixed reference patterns in check_protect() to upper case hex letters
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| | |
This is a difficult tradeoff to measure. I think large
datagrams won't be used very frequently. So it is better to
not lock a large buffer to each socket object and instead
allocate and deallocate for each operation receiving a
datagram larger than UDP_DATAGRAMSIZE.
|
| | | |
|
| | |
| |
| |
| |
| | |
Also dealing with EPROTOTYPE Yosemite seems to be throwing
at us for no reason.
|
| | |
| |
| |
| | |
Makes initialization code simpler everywhere.
|
| |/ |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|