aboutsummaryrefslogtreecommitdiffstats
path: root/util
Commit message (Collapse)AuthorAgeFilesLines
* util.datamanager: Fix not passing variables as format string to logger ↵Kim Alvefur2021-01-161-1/+1
| | | | | | | (thanks semgrep) Passing error messages as format string could lead to errors, although not a problem anymore since util.format sanitizes this.
* Merge 0.11->trunkKim Alvefur2021-01-082-3/+16
|\
| * util.timer: Ensure timers can't run more than once per tick (fixes #1620)Kim Alvefur2021-01-081-1/+14
| | | | | | | | See longer explanation in 2c559953ad41
| * util.stanza: Move misplaced argument to correct placeKim Alvefur2020-12-241-2/+2
| | | | | | | | | | valid_utf8() takes only one argument, so the false was probably meant to be valid_xml_cdata(text, attribute=false)
* | util.error: Switch to util.debug traceback tables and remove ↵Matthew Wild2020-12-091-9/+6
| | | | | | | | display_tracebacks option
* | util.error: Expose is_error on registry objects for convenienceMatthew Wild2020-12-091-0/+1
| |
* | util.error: rename is_err() -> is_error()Matthew Wild2020-12-091-5/+6
| | | | | | | | More descriptive and consistent with e.g. is_promise().
* | util.error: Add coerce and wrap methods to registry(?) objectsMatthew Wild2020-12-091-0/+19
| |
* | Merge 0.11->trunkMatthew Wild2020-11-231-1/+1
|\|
| * util.promise: Use xpcall() for promise function to preserve tracebacksMatthew Wild2020-11-231-1/+1
| |
* | util.hashring: Normalize indentation to tabsKim Alvefur2020-11-151-8/+8
| |
* | util.error: Remove a stray word from a commentKim Alvefur2020-11-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | Earlier in the process the namespace could be given in the registry table, the comment would have read > registry can be given as second argument if namespace is either not > used or is given in the registry table The word seems to have been left when this method was scrapped for being complicated and redundant.
* | Merge 0.11->trunkKim Alvefur2020-11-111-1/+9
|\|
| * util.stanza: Reject ASCII control characters (fixes #1606)Kim Alvefur2020-11-111-1/+9
| |
* | util.prosodyctl.cert: Fix for prompt functions having moved to util.human.ioKim Alvefur2020-11-091-3/+4
| |
* | util.cache: Add __name to metatableMatthew Wild2020-10-301-1/+1
| |
* | util.dbuffer: Add __name to metatableMatthew Wild2020-10-301-1/+1
| |
* | Merge 0.11->trunkMatthew Wild2020-10-281-4/+26
|\|
| * util.dbuffer: Optimize :sub() and :byte()Matthew Wild2020-10-281-4/+26
| |
* | util.paths: Optimize path joining with few argumentsKim Alvefur2020-10-111-2/+12
| | | | | | | | | | | | | | | | | | A casual search suggests that the majority of paths.join() calls involve only two arguments. This saves the creation of a table for up to 3 arguments. Looks like 3x faster for 3 arguments or less, 5% slower when it uses the array to concatenate.
* | Merge 0.11->trunkMatthew Wild2020-10-161-1/+1
|\|
| * util.debug: Fix locals being reported under wrong stack frame in some cases ↵Matthew Wild2020-10-161-1/+1
| | | | | | | | (+tests!!)
* | util.sasl.scram: Use util.strbitop for XOR stepKim Alvefur2019-09-071-29/+1
| |
* | util.error: Pass through existing error objects passed to new()Matthew Wild2020-10-151-0/+1
| |
* | Merge 0.11->trunkKim Alvefur2020-10-121-0/+1
|\|
| * util.dbuffer: Expose length as :len() method, like stringsKim Alvefur2020-10-121-0/+1
| | | | | | | | Ref #1598
| * util.dependencies: Check for bitop library same way as net.websocket.frames ↵Kim Alvefur2020-10-051-1/+1
| | | | | | | | (fixes #1594)
| * MergeMatthew Wild2020-09-302-0/+183
| |\
| | * util.dbuffer: Fix :sub() not working with partially-consumed chunks (thanks ↵Matthew Wild2020-08-241-0/+176
| | | | | | | | | | | | | | | | | | Zash for test case) This also appears to fix some bugs with chunk-encoded streams in net.http.parser.
| | * util.dbuffer: dynamic string bufferMatthew Wild2020-06-261-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to util.ringbuffer (and shares almost identical API). Differences: - size limit is optional and dynamic - does not allocate a fixed buffer of max_size bytes - focus on simply storing references to existing string objects where possible, avoiding unnecessary allocations - references are still stored in a ring buffer to enable use as a fast FIFO Optional second parameter to new() provides the number of ring buffer segments. On Lua 5.2 on my laptop, a segment is ~19 bytes. If the ring buffer fills up, the next write will compact all strings into a single item.
* | | util.startup: Handle missing nparams field from debug info (not present in 5.1)Matthew Wild2020-10-111-2/+3
| | |
* | | util.startup: Include arguments in function string representationKim Alvefur2020-10-091-2/+8
| | | | | | | | | | | | | | | | | | | | | Improves usability of the console when digging around the internals. No specific rationale for the function<file:line>(args) format, it looked best of the variants I tried.
* | | util.startup: Retrieve less data for function string representationKim Alvefur2020-10-091-1/+1
| | | | | | | | | | | | debug.getinfo(f) collects more info than what is needed here.
* | | util.startup: Save the path used by the installer to prosody.pathsKim Alvefur2020-10-071-0/+1
| | | | | | | | | | | | | | | | | | Makes it easier for other parts of the code to use this for things, such as determining whether a certain module is from this path or from elsewhere.
* | | util.startup: Fix startup failure if CFG_DATADIR is unsetKim Alvefur2020-10-051-1/+1
| | | | | | | | | | | | As is normal when running from source
* | | util.startup: Re-enable installer path setupKim Alvefur2020-10-051-2/+2
| | |
* | | util.startup: Put 'installer_plugin_path' under data directory by defaultKim Alvefur2020-10-051-1/+1
| | | | | | | | | | | | | | | Fixes issue where it ends up creating this in $PWD, which might be ~prosody, ~you or /, depending on how it's invoked.
* | | util.prosodyctl: Simplify luarocks invocationKim Alvefur2020-10-051-7/+3
| | |
* | | util.prosodyctl: Move hardcoded luarocks server into prosodyctlKim Alvefur2020-10-051-2/+2
| | | | | | | | | | | | To be replaced with config option in future commit
* | | util.prosodyctl: Flip argument orderKim Alvefur2020-10-051-1/+1
| | | | | | | | | | | | | | | "verb subject" feels better than "subject verb", especially since the subject (module) is optional.
* | | util.prosodyctl: Construct luarocks command line with templatesKim Alvefur2020-10-051-2/+7
| | | | | | | | | | | | More flexible and safer wrt escaping
* | | util.pluginloader: Look for module libs in mod_plugin/lib.luaKim Alvefur2020-10-051-0/+3
| | | | | | | | | | | | | | | Luarocks can't be told to install something as foo.lib.lua AFAIK, so instead let's try mod_bar/foo.lua
* | | util.pluginloader: Look for top level mod_something.lua in luarocks-style treeKim Alvefur2020-10-051-0/+1
| | |
* | | util.pluginloader: Extract Lua version onceKim Alvefur2020-10-051-1/+1
| | | | | | | | | | | | It's not going to change while the module is loaded.
* | | util.xml: Fix float formatting of line and columns in error (on Lua 5.3+)Kim Alvefur2020-10-031-1/+1
| | |
* | | Merge 0.11->trunkMatthew Wild2020-09-301-1/+1
|\| |
| * | util.indexedbheap: Fix heap datastructure corruption in ↵Waqas Hussain2020-09-291-1/+1
| |/ | | | | | | :reschedule(smaller_value)
| * util.startup: Configure the GC on startup, using the config or built-in defaultsMatthew Wild2020-06-151-0/+17
| |
| * util.gc: Linter fixes [luacheck]Matthew Wild2020-06-151-2/+1
| |
| * util.gc: New module for configuring the Lua garbage collectorMatthew Wild2020-06-151-0/+50
| |