aboutsummaryrefslogtreecommitdiff
path: root/test/testclnt.lua (follow)
Commit message (Collapse)AuthorAgeFilesLines
* chore(test): add 2 tests reusing partial resultsThijs Schreijer3 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-301-0/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 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-221-51/+49
| | | | | 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.
* Fix. Optional IPv6 testmoteus2013-05-271-2/+8
|
* Test server exits gracefully at command of test clientDiego Nehab2012-05-011-0/+7
|
* Update method list in testsFlorian Zeitz2012-04-291-1/+4
|
* Test method registration for IPv6 socketsFlorian Zeitz2012-04-291-4/+9
|
* change localhost to loopback ip to prevent error on my mac box????Liam Devine2012-04-111-2/+3
|
* Compiles with Lua 5.1.4 and Lua 5.2.0-beta, although the makefile needs ↵Liam Devine2012-04-111-5/+10
| | | | sorting out to take maybe a version number and also the local paths need removing.
* Saving before big changes to support IPv6.Diego Nehab2011-05-251-47/+75
|
* Decent makefiles!Diego Nehab2009-05-271-5/+38
|
* Removed os.exit from test.Diego Nehab2007-06-111-1/+0
|
* Crashy bug fixed in recvraw.Diego Nehab2007-06-111-1/+60
| | | | Also fixed returns on closed socket.
* Couple bug fixes.Diego Nehab2007-03-121-1/+1
|
* Almost ready to release.Diego Nehab2005-09-291-1/+2
|
* Working on the manual.Diego Nehab2005-06-141-1/+1
|
* Forward server working on Mac OS X...Diego Nehab2005-02-081-9/+7
|
* Almost ready for beta3Diego Nehab2004-11-271-4/+1
|
* Beta2 is out! Total timeout works on Windows.Diego Nehab2004-07-261-18/+21
|
* Changed send function.Diego Nehab2004-07-181-25/+61
|
* Fixed a bunch of stuff. Added mike's patches.Diego Nehab2004-07-161-6/+6
|
* Works fine with the new linking in Linux.Diego Nehab2004-07-021-2/+0
|
* tiny bug in test.Diego Nehab2004-07-021-5/+8
|
* Compiles and runs on windows.Diego Nehab2004-07-021-0/+22
|
* Added getstats.Diego Nehab2004-07-011-0/+1
|
* Moving on to beta2.Diego Nehab2004-07-011-28/+34
|
* More adjustments/bugfixes.Diego Nehab2004-06-211-2/+2
|
* Fixing bugs...Diego Nehab2004-06-201-8/+10
|
* Changed the return of the send function...Diego Nehab2004-06-171-4/+4
|
* Compiled and tested on Windows...Diego Nehab2004-06-171-2/+4
|
* Runs on Linux.Diego Nehab2004-06-151-1/+1
|
* Manual is almost done. HTTP is missing.Diego Nehab2004-06-151-1/+1
| | | | | | | Implemented new distribution scheme. Select is now purely C. HTTP reimplemented seems faster dunno why. LTN12 functions that coroutines fail gracefully.
* Changed require"luasocket" to require"socket".Diego Nehab2004-05-281-1/+1
|
* Previous bug fix caused a new bug. :o/Diego Nehab2004-05-281-12/+15
|
* Bug feioso no UDP e possivelmente no TCP também.Diego Nehab2004-05-281-0/+2
|
* Changed receive function. Now uniform with all other functions. Returns nilDiego Nehab2004-03-211-15/+19
| | | | | | on error, return partial result in the end. http.lua rewritten.
* Worked on the manual.Diego Nehab2004-02-041-13/+15
| | | | | Implemented stuffing (needs test) Added cddb and qp examples.
* DNS lookup was taking too long and fucking up the connect tests.Diego Nehab2004-01-241-3/+5
|
* Working on the manual...Diego Nehab2004-01-241-2/+2
| | | | | | Making better tests for error messages. Changed a few names. Moved gethostname to inet.c.
* New accept/connect code.Diego Nehab2004-01-241-31/+58
| | | | | | Better error checking. Better tests. __tostring implemented.
* Adjusted wsocket to match usocket. Adjusted windows projects.Diego Nehab2004-01-211-6/+10
|
* Fixed functions that return messages in ?socket.c.Diego Nehab2004-01-211-0/+16
| | | | | | Moved complexity of connect and accept there. Created a new options.c module to take care of options. Auxiliar.c is now cleaner.
* Seems to be working on windows and linux.Diego Nehab2004-01-191-4/+1
|
* Have to figure out how to test timeout on connect... kind of hard.Diego Nehab2004-01-181-11/+11
|
* Fixed bug in accept, added tests for it and for connect with timeout.Diego Nehab2004-01-181-11/+51
|