aboutsummaryrefslogtreecommitdiff
path: root/test (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add SSE sink (socket.sse module)feat/sseThijs Schreijer3 days3-12/+556
| | | | | | | 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
* Add CI-runnable HTTP test fixture on the testsrvr/testclnt harnessThijs Schreijer3 days2-0/+172
| | | | | | | | | | | | 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
* Merge pull request #472 from lunarmodules/feat/url-hosttypeCaleb Maclennan3 days1-0/+196
|\ | | | | feat(url): classify host as name/ipv4/ipv6 in parse and build
| * feat(url): classify host as name/ipv4/ipv6 in parse and buildThijs Schreijer4 days1-0/+196
| | | | | | | | | | | | | | | | | | | | 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-0/+200
|\ \ | | | | | | Fix/http size protect
| * | feat(http/ftp/smtp): implement max size checksThijs Schreijer5 days2-0/+200
| | | | | | | | | | | | | | | fixes unbounded reads when using the "*l" pattern. Typically on headers and other control lines.
* | | Merge pull request #470 from lunarmodules/header-canonCaleb Maclennan3 days1-0/+131
|\ \ \ | | | | | | | | feat(headers): dynamically create cononicalized headers
| * | | Apply code review suggestionsThijs Schreijer5 days1-1/+1
| | | | | | | | | | | | Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| * | | feat(headers): dynamically create cononicalized headersThijs Schreijer5 days1-0/+131
| | |/ | |/| | | | | | | | | | | | | | | | | | | 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 days3-0/+503
|\ \ \ | | | | | | | | fix(receive): a receive 0 should immediately return, not block
| * | | fix(udp): receive(0) tests and bad call to getnameinfoThijs Schreijer4 days3-0/+467
| | | |
| * | | fix(receive): a receive 0 should immediately return, not blockThijs Schreijer4 days1-0/+36
| | |/ | |/| | | | | | | | | | | | | | | | | | | 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
* / | chore(test): add 2 tests reusing partial resultsThijs Schreijer4 days1-3/+20
|/ / | | | | | | | | Tests to show the socket isn't left in an undetermined state due to dataloss, since the partial results are returned to the user.
* | fix(receive): guard numeric pattern against size_t overflow on castThijs Schreijer5 days1-2/+4
| | | | | | | | | | | | 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-2/+4
| | | | | | | | | | 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-302-0/+219
|/ | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* fix(http): Allow relative redirect on https (#395)Henri D2022-10-081-0/+31
| | | Location header can now be relative: https://httpwg.org/specs/rfc9110.html#field.location
* refactor: Address issues raised by linterThijs Schreijer2022-03-199-146/+146
|
* test/find-connect-limit: add missing "socket ="E. Westbrook2020-03-281-1/+1
|
* test/udp-zero-length-send-recv: add missing "socket ="; use shebang ↵E. Westbrook2020-03-281-2/+2
| | | | "#!/usr/bin/env lua"
* test/udp-zero-length-send: add missing "socket ="; use shebang ↵E. Westbrook2020-03-281-2/+2
| | | | "#!/usr/bin/env lua"
* test/getoptions: guard calls with pcall(); check result of getoption"linger"E. Westbrook2020-03-281-4/+18
|
* test/tcp-getoptions: bugfix: missing "socket =" in require"socket"E. Westbrook2020-03-281-1/+1
|
* Merge pull request #116 from linuxmaniac/masterDiego Nehab2019-02-241-1/+3
|\ | | | | Add "tcp-keepidle", "tcp-keepcnt" and "tcp-keepintvl" options
| * Add "tcp-keepidle", "tcp-keepcnt" and "tcp-keepintvl" optionsVictor Seva2014-12-051-1/+3
| |
* | url.lua:remove_dot_components(): use temporary NUL marker to reduce ↵E. Westbrook2018-08-211-0/+4
| | | | | | | | empty-segment special-case code
* | url.lua:remove_dot_components(): empty path component double-dot corner caseE. Westbrook2018-08-211-0/+1
| |
* | url.lua:absolute_path(): ensure a separator between base_path and relative_pathE. Westbrook2018-08-211-1/+1
| |
* | url.lua:remove_dot_components(): avoid overconsuming dot segmentsE. Westbrook2018-08-211-0/+5
| |
* | url.lua:remove_dot_components(): limit beginning-of-string double-dot corner ↵E. Westbrook2018-08-211-0/+1
| | | | | | | | case to prevent triple-dot activation and authority collision
* | url.lua: separate remove_dot_components() from absolute_path(); also use in ↵E. Westbrook2018-08-211-4/+4
| | | | | | | | _M.absolute() even when not merging
* | url.lua:absolute_path(): fix issue #254, simplify, add more test casesE. Westbrook2018-08-191-1/+24
| |
* | Add ltn12.source.table()E. Westbrook2018-06-051-0/+9
| |
* | fixed url parsing; postpone fragment parsing after authority parsing; added ↵Herbert Leuwer2017-11-221-3/+72
| | | | | | | | | | | | test cases to test/urltest.lua fixed reference patterns in check_protect() to upper case hex letters
* | Preserve path when parsing urls.Diego Nehab2017-03-201-1/+1
| |
* | rename unix.tcp to unix.stream, unix.udp to unix.dgramenginix2016-12-254-5/+5
| |
* | support datagram unix domain socketsenginix2016-06-244-2/+20
| |
* | Family agostic FTP and expose HTTP/FTP url parsingDiego Nehab2016-03-071-11/+23
| |
* | Don't swallow errors in finalizers.Philipp Janda2016-02-241-1/+0
| |
* | Add more tests for socket.try/protectmpeterv2016-02-211-4/+29
| |
* | Changed buffer-per-socket to buffer-per-operation.Diego Nehab2015-10-061-1/+0
| | | | | | | | | | | | | | | | 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.
* | Fixes suggested by @Florob in #147.Diego Nehab2015-08-251-7/+12
| |
* | New agnostic IPv4 IPv6 functions.Diego Nehab2015-08-223-53/+51
| | | | | | | | | | Also dealing with EPROTOTYPE Yosemite seems to be throwing at us for no reason.
* | New compat.h module implements luaL_setfuncs.Diego Nehab2015-08-211-1/+1
| | | | | | | | Makes initialization code simpler everywhere.
* | Out of the box support for Lua 5.3.Diego Nehab2015-02-183-16/+20
|/
* support multiple filters in ltn12.{sink,source}.chain()Fabien Fleutot2013-06-181-0/+25
|
* Fix makefile and test_socket_error.luaDiego Nehab2013-06-121-2/+6
|
* Unix domain tests still broken.Diego Nehab2013-05-302-12/+12
|
* Add. Allow get `error` option to socket.moteus2013-05-291-0/+27
|
* Fix. use table.unpack in mimetest on Lua 5.2.moteus2013-05-271-0/+2
|