aboutsummaryrefslogtreecommitdiff
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add Lua 5.5 support (#473)Caleb Maclennan3 days1-2/+2
|
* feat(core): Handle response code 308 permanent redirectAmanda Stjerna3 days1-1/+1
|
* Merge pull request #472 from lunarmodules/feat/url-hosttypeCaleb Maclennan3 days2-7/+49
|\ | | | | feat(url): classify host as name/ipv4/ipv6 in parse and build
| * fix(http): bracket IPv6 host in Host headerThijs Schreijer4 days1-1/+2
| | | | | | | | | | | | | | | | | | 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
| * feat(url): classify host as name/ipv4/ipv6 in parse and buildThijs Schreijer4 days1-6/+47
| | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #467 from lunarmodules/fix/http-size-protectCaleb Maclennan3 days2-8/+37
|\ \ | | | | | | Fix/http size protect
| * | feat(http/ftp/smtp): implement max size checksThijs Schreijer5 days2-8/+37
| | | | | | | | | | | | | | | fixes unbounded reads when using the "*l" pattern. Typically on headers and other control lines.
| * | refactor(receive): make implicit line reads explicitThijs Schreijer5 days2-7/+7
| | |
* | | Merge pull request #470 from lunarmodules/header-canonCaleb Maclennan3 days1-94/+54
|\ \ \ | | | | | | | | feat(headers): dynamically create cononicalized headers
| * | | Apply code review suggestionsThijs Schreijer5 days1-0/+3
| | | | | | | | | | | | Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| * | | feat(headers): dynamically create cononicalized headersThijs Schreijer5 days1-94/+51
| | |/ | |/| | | | | | | | | | | | | | | | | | | Instead of a static list dynamically add entries in proper casing. Also allowing to add non-standard ones through `setcanonic`. closes #442 fixes #440
* | | Merge pull request #471 from lunarmodules/fix/zero-readCaleb Maclennan3 days4-10/+36
|\ \ \ | | | | | | | | fix(receive): a receive 0 should immediately return, not block
| * | | fix(udp): receive(0) tests and bad call to getnameinfoThijs Schreijer4 days2-0/+20
| | | |
| * | | fix(receive): a receive 0 should immediately return, not blockThijs Schreijer4 days3-10/+16
| | |/ | |/| | | | | | | | | | | | | | | | | | | 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
* | | Merge pull request #463 from lunarmodules/feat/receive-limitCaleb Maclennan3 days1-20/+90
|\| | | | | | | | feat(receive): add maxsize argument to bound memory usage
| * | fix(receive): guard numeric pattern against size_t overflow on castThijs Schreijer5 days1-1/+2
| | | | | | | | | | | | | | | | | | 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.
| * | fix(receive): guard maxsize against size_t overflow on castThijs Schreijer5 days1-1/+2
| | | | | | | | | | | | | | | Casting a double larger than SIZE_MAX to size_t is undefined behavior; bound-check maxsize before the cast.
| * | feat(receive): add maxsize argument to bound memory usageThijs Schreijer2026-07-301-20/+88
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* / feat(core): Add option for Windows SO_EXCLUSIVEADDRUSEWires773 days4-0/+37
|/
* feat(udp): Allow changing UDP_DATAGRAMSIZE at compile time (#452)Victor Bombi2025-11-141-0/+2
|
* feat: Add ucrt64 support in makefile (#455)Raffaello Bertini2025-05-291-1/+26
|
* chore: Remove the executable permission bit from some source files (#434)Tianjia Zhang2024-06-297-0/+0
|
* fix(unix): Pass correct path length for abstract sockets (#430)Kim Alvefur2024-05-242-41/+42
|
* chore(http): Correct typos in error message and code comments (#423)Alexandre Detiste2024-02-123-6/+6
|
* fix(http): Use the right protocol for proxies (#386)Max1Truc2023-11-231-3/+8
|
* fix(http): Correct receiveheaders() handling of folded values (#420)_AMD_2023-11-131-1/+1
|
* chore(core): Update version markers to last released versionCaleb Maclennan2023-11-112-2/+2
| | | | Closes #401
* Merge pull request #418 from alerque/url-empty-pathCaleb Maclennan2023-11-091-1/+1
|\
| * fix(url): Avoid fragment being part of authority, allows parsing empty pathsCaleb Maclennan2023-11-081-1/+1
| |
| * fix(url): Avoid query string being part of authority, allows parsing empty pathsCaleb Maclennan2023-11-081-1/+1
| |
* | fix(wsocket): Properly report CONNRESET (#81)Paul Kulchenko2023-11-091-0/+2
|/
* fix(inet): Return port as number in getsockname (#392)georgeto2023-11-081-1/+1
|
* refactor(core): Replace check for SO_BINDTODEVICE support with platform ↵leso-kn2023-10-271-2/+2
| | | | independent version
* fix(core): Disable SO_BINDTODEVICE on windowsleso-kn2023-10-271-2/+2
| | | | Co-authored-by: Sewbacca <sebastian.kalus@kolabnow.com>
* feat(tcp): Add 'bindtodevice' option (#408)Leso_KN2023-10-233-0/+32
|
* fix(http): Allow relative redirect on https (#395)Henri D2022-10-081-2/+3
| | | Location header can now be relative: https://httpwg.org/specs/rfc9110.html#field.location
* Revert "fix(usocket): Fix typo in return value function name"Caleb Maclennan2022-08-311-1/+1
| | | | | | This reverts commit 88c72acd771ac6c96ea7f4e57293307e282ad49f. See discussion on #390
* style(usocket): Remove trailing space at EOLzhaozg2022-08-301-1/+1
|
* fix(usocket): Fix typo in return value function namezhaozg2022-08-301-1/+1
|
* style(core) Remove lingering c-style comment (#388)George Zhao2022-08-271-1/+1
|
* fix(build): Use gai_strerrorA not gai_strerror on Windowsrpatters12022-07-275-6/+8
| | | | | | | | | | | * Explicitly call gai_strerrorA (for Windows builds), so that the code work correctly in 32bit or 64bit builds. * Implement GAI_STRERROR macro to deal with Windows vs. Non-Windows compiles for 64-bit. * make usocket.c consistent with other modules that call macro GAI_STRERROR * Use different name not just different case for macro wrapping function Co-authored-by: Caleb Maclennan <caleb@alerque.com>
* feat(tcp): Add support for TCP Defer AcceptKim Alvefur2022-07-273-0/+16
| | | | | | | | 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>
* feat(tcp): Add support for TCP Fast OpenKim Alvefur2022-07-273-0/+29
|
* chore: Update internal version references to match release (#370)Robert Scheck2022-03-282-2/+2
|
* chore; add Lua 5.4 to make filesThijs Schreijer2022-03-231-6/+6
|
* http.lua: set transfer-encoding if source and no content-lengthJulian Squires2022-03-221-0/+7
| | | | | | | | | | | | | | If a source is specified without a content-length header, LuaSocket sends the data in the chunked transfer coding; however, it doesn't set the transfer-encoding header. While I recognize that the user can set this manually, this is a gotcha that has caught me multiple times. RFC7230, section 3.3.3 (https://tools.ietf.org/html/rfc7230#section-3.3.3) is clear about this; if neither content-length nor transfer-encoding chunked are specified, the request message body length is zero. While some servers may ignore this, I have encountered several that follow the RFC in this regard, most recently golang's net/http.
* src/ltn12.lua: remove duplicated codesdavid2022-03-211-3/+3
|
* Merge pull request #354 from lunarmodules/linterCaleb Maclennan2022-03-196-35/+24
|\
| * refactor: Address issues raised by linterThijs Schreijer2022-03-196-35/+24
| |
* | style: Use C-style comment syntax throughout (#309)Caleb Maclennan2022-03-184-37/+38
|/ | | Co-authored-by: Denise Cullassnekuff <19711487+BlackCutpoint@users.noreply.github.com>