Kim Alvefur
e081fd6642
util.serialization: Cache default serialization instance ( fixes #1389 )
...
Most serialization uses still use the default serialize() and thus
duplicate much of the setup, which negates some of the performance
improvements of the rewrite.
7 years ago
Kim Alvefur
c2576aea62
util.sql: Ignore if tables and indices already exist on creation ( fixes #1064 )
...
Tested with SQLite3 3.16.2 and 3.27.2 and Postgres 11.
MySQL does not support IF NOT EXISTS for indices so not handled here.
7 years ago
Kim Alvefur
a6e44a24a0
util.random: Throw different error for EOL condition
7 years ago
Kim Alvefur
c42ccf1bcc
util.random: Coerce error to string (thanks waqas)
...
In theory this could happen in an EOF condition, which should be
impossible with a read from /dev/urandom.
7 years ago
Kim Alvefur
60c9443a7b
util.random: Handle unlikely read errors from /dev/urandom (see #1313 )
7 years ago
Kim Alvefur
86b34563eb
util.ip: Add missing netmask for 192.168/16 range ( fixes #1343 )
7 years ago
Kim Alvefur
5d4504e51b
util.pubsub: Validate node configuration on node creation ( fixes #1328 )
7 years ago
Kim Alvefur
da56744645
util.pubsub: Add support for requesting multiple specific items (needed for #1305 )
7 years ago
Kim Alvefur
ce17a974fc
util.startup: Always reload logging after config ( fixes #1284 )
...
This chancged in 6e24a69b03af likely because of confusion about the
`reopen-log-files` event which was fired but never hooked.
7 years ago
Kim Alvefur
9f19a48ee2
util.pubsub: Restore subscription index from stored data ( fixes #1281 )
7 years ago
Kim Alvefur
968eaf41a8
util.datetime: Make sure timezone difference is calculated correctly ( fixes #1262 )
...
If the two os.date() calls happen at either side of a second ticking
over there would be a one second error in the calculation.
7 years ago
Kim Alvefur
76536dab05
util.stanza: Deserialize stanza without mutating input ( fixes #711 )
7 years ago
Kim Alvefur
50f6335501
util.stanza: Validate input to clone() (with brief tests)
7 years ago
Kim Alvefur
1086a1325d
util.sql: Switch from hacky multi-arg xpcall implementation to util.xpcall
7 years ago
Kim Alvefur
ed25cd6f85
util.sslconfig: Recognise TLS 1.3 as a protocol version
...
This enables it to understand protocol = "tlsv1_3+"
7 years ago
Kim Alvefur
a261de73b9
util.serialization: Encode non-fatal error in way that can be restored
...
It could previously encode to eg `{ [nil] = ... }` which doesn't get decoded
7 years ago
Kim Alvefur
1497806989
util.serialization: Rename non-fatal fallback handler for clarity
7 years ago
Kim Alvefur
28031d133d
util.serialization: Disable use of unquoted table keys by default
...
For safety against future new keywords
7 years ago
Kim Alvefur
fdbc23fab6
util.serialization: Add option for allowing multiple references to the same table (but not cycles)
7 years ago
Kim Alvefur
bdadc69e1a
util.serialization: Separate errors for multiple table references and max depth
7 years ago
Kim Alvefur
97c56e6c71
util.serialization: Make maximum table depth configurable
7 years ago
Matthew Wild
f5f6460b2e
Many things: switch from hacky multi-arg xpcall implementations to a standard util.xpcall
7 years ago
Matthew Wild
1454ac8208
util.xpcall, util.compat: Add non-hacky multi-argument xpcall() for Lua 5.1
7 years ago
Matthew Wild
9fdfa590d2
util.dependencies: Remove ztact compatability warning
7 years ago
Matthew Wild
6990069677
util.promise: Switch from pcall to xpcall to get tracebacks on exceptions
7 years ago
Matthew Wild
8ea77fc0ec
util.promise: Remove the non-standard ability to pass a promise to reject()
7 years ago
Matthew Wild
e6ff6e333c
util.promise: Fix missing parameters
7 years ago
Matthew Wild
b74a643e34
util.promise: Ensure chained promises always receive a value/rejection even if an intermediate promise has no handlers
7 years ago
Matthew Wild
c7d9ee0bb8
util.promise: Export is_promise()
7 years ago
Matthew Wild
5d8613b3c1
util.promise: Remove debug print and assert
7 years ago
Kim Alvefur
eaac53d041
util.pubsub: Clarify comment about return value
7 years ago
Matthew Wild
e12a6cdb99
util.array: Add __div for parity with util.set
7 years ago
Matthew Wild
fbb11b868f
util.array: Break long line
7 years ago
Matthew Wild
05b4064188
util.promise: Add promise.try()
7 years ago
Matthew Wild
44b3954d56
util.pubsub: Allow publishing with a config that should be used as defaults only
7 years ago
Kim Alvefur
dd2f749996
util.promise: Add a string representation
7 years ago
Matthew Wild
681b25e427
util.promise: Add promise:finally()
7 years ago
Matthew Wild
894fe1b808
util.promise: Some code relocation
7 years ago
Matthew Wild
7bcf751702
util.promise: Also support automatic resolution by returning a promise from an on_reject handler
...
Originally unimplemented because it wasn't clear to me what the correct behaviour was, but the A+
spec is clear that both onFulfilled and onRejected may return a promise.
7 years ago
Matthew Wild
ef7d6ba99e
util.promise: Fix promise.reject() to return a rejected promise, and fix buggy test for it
7 years ago
Kim Alvefur
0247a0e904
mod_http: Move normalize_path to util.http
7 years ago
Kim Alvefur
284152ba25
util.dependencies: Add compat code for normalization of socket constructors
...
Old LuaSocket had only tcp() which was IPv4-only. LuaSocket ~3.0 adds a
tcp6() that creates a IPv6 socket. Some version moves tcp() to tcp4()
and adds an IP-version-agnostic tcp() constructor.
7 years ago
Kim Alvefur
e2321c4d37
util.stanza: Set preserialize as freeze metamethod
7 years ago
Kim Alvefur
1ab9729aac
util.set: Add freeze metamethod
7 years ago
Kim Alvefur
15ba5f41b1
util.array: Add freeze metamethod
7 years ago
Kim Alvefur
1789a7adf8
util.serialization: Remove encoding of very large or very small numbers in scientific notation
...
Also difficult to describe this option, easier to remove it.
%.18g covers a very large range of numbers
7 years ago
Kim Alvefur
e0a16c75dc
util.serialization: Simpler metatable pre-processing
...
It was too difficult to describe what it did.
7 years ago
Kim Alvefur
8d941e5d0f
util.serialization: Use '=' prefix for chunk source description
...
Like in bd5e4485a245
7 years ago
Kim Alvefur
09c19925cc
util.serialization: Make check of prefix for optional hex encoding stricter
7 years ago
Kim Alvefur
e99c680a14
util.serialization: Make errors fatal by default (like the previous implementation)
7 years ago