Commit graph

91 commits

Author SHA1 Message Date
Yorhel
6c54ee3091 FU: Reject some invalid characters in path 2025-05-09 08:32:41 +02:00
Yorhel
6787f32fd9 DebugInfo: Fix handling of undef and falsy bind parameters 2025-05-03 12:32:52 +02:00
Yorhel
cbccf045b7 DebugInfo: Expand queries table with params & details
Apart from the ugly implementation, this is pretty neat.
2025-05-01 12:18:26 +02:00
Yorhel
76f55f277b Pg: Add text2bin() and bin2text() conversion methods 2025-04-30 20:02:20 +02:00
Yorhel
beeefcf337 Pg: Add perl2bin() and bin2perl() conversion methods 2025-04-30 17:07:44 +02:00
Yorhel
af9340f908 DebugInfo: Styling + add request/response body and fu obj contents
Formatting is still shit.
2025-04-30 15:00:26 +02:00
Yorhel
f8b0043e22 MultipartFormData: Bunch of parser fixes 2025-04-29 09:14:44 +02:00
Yorhel
753cac615a Validate: Improved + extendable error message formatting
Very much needed for VNDB's advanced search validation.
Also completely undocumented.
2025-04-26 15:56:12 +02:00
Yorhel
5f8809d052 FU::Util::query_decode(): Properly handle empty "&"-parts 2025-04-25 17:07:56 +02:00
Yorhel
e88ad65232 Version 0.5 2025-04-24 14:16:17 +02:00
Yorhel
13271fa413 Minor changes & fixes 2025-04-23 16:12:39 +02:00
Yorhel
8096de7497 MultipartFormData: Fix ->save() on zero-length values 2025-04-22 18:54:04 +02:00
Yorhel
1594006739 FU: Improve merging of "Vary" response headers + debug header listing 2025-04-20 11:40:27 +02:00
Yorhel
8b807e6dcf Validate: Add empty() and coerce() methods
Implementing the undocumented coerce_for_json() method from TUWF and
elm_empty() from VNDB.
2025-04-19 12:36:28 +02:00
Yorhel
196b1cc3ce FU: Use CLOCK_MONOTONIC for timing 2025-04-07 16:41:29 +02:00
Yorhel
b3281924d1 Pg: Add escape_literal() and escape_identifier()
Didn't expect I'd ever need these, but they're useful for generating SQL
scripts.
2025-04-07 13:45:33 +02:00
Yorhel
13661b46f9 Validate: Normalize num/int/uint to Perl numeric types + add 64bit limit to int/uint
Normalization may be undone by later validations, but this should work
in most cases.
2025-03-30 13:55:23 +02:00
Yorhel
2f50736782 fdpass_recv: Set O_CLOEXEC on received fds
Turns out this is necessary even if the fd is going to be passed through
exec() soon, because the supervisor might receive multiple fds before
spawning another process, in which case all of them are going to be
passed to the new process instead of just one.
2025-03-24 11:07:39 +01:00
Yorhel
90881924d4 Doc fixes 2025-03-21 11:31:20 +01:00
Yorhel
7c765f33bb Version 0.4 2025-03-19 10:54:23 +01:00
Yorhel
6159b33950 FU::Util: Add brotli_compress() and use it for FU output compression
Seems to compresses and perform better than libdeflate at level 6, so
certainly worth using.
2025-03-19 10:12:20 +01:00
Yorhel
bc33fe53f0 FU::Util: Add gzip_compress() wrapper for libdeflate/zlib-ng/zlib
And use it for automatic output compression in FU, as (potentially)
faster alternative to Compress::Raw::Zlib.

Was also planning to maybe add support for Zstd or Brotli, but given the
performance of libdeflate, I'm not sure that's really necessary. Brotli
does tend to do a better job at compressing HTML, though.
2025-03-18 16:59:43 +01:00
Yorhel
d8ecc71abb FU: Add fu->set_cookie() (+ uri_unescape '+' fix) 2025-03-17 13:46:14 +01:00
Yorhel
a7bfe146b1 Validate: Fix referencing & merging already compiled schemas 2025-03-17 12:50:24 +01:00
Yorhel
3382deba9a Validate: Rename "scalar" to "accept_scalar" and add "accept_array" 2025-03-16 15:39:10 +01:00
Yorhel
f8fe53cba9 json_format: Add html_safe option 2025-03-16 15:03:32 +01:00
Yorhel
3fad7feec3 Validate: Rename "values"->"elems", repurpose "values" to validate hash values
I'm breaking stuff left and right while I still can.

Idea: "key_names" validation?

Idea: "tuple" validation that works like "keys" but for arrays.
  (i.e. { tuple => { $index => $schema } }, could make "missing" and
  "unknown" work for arrays, too)
2025-03-14 16:52:33 +01:00
Yorhel
fa24ca53e3 Validate: improved arrayref-schema semantics
This allows all built-in options to be duplicated inside a single
schema, the semantics of which are the same as the kind of merging
done as part of inheriting options from custom validations.

This also causes all 'keys' and 'values' validation schemas to be
merged, which changes error messages a bit but is great for
introspection. Probably slightly improves performance as well.
2025-03-14 14:28:28 +01:00
Yorhel
cea691dd55 Validate: drop creation of default values for built-ins
To better support merging multiple validations, which'll come next.
Probably.
2025-03-14 10:52:12 +01:00
Yorhel
f248a33c1c Validate: Allow multiple func validations in arrayref schema 2025-03-14 09:25:56 +01:00
Yorhel
1363e11269 Validate: allow array schemas + defer known_keys hash creation
Doesn't allow multiple 'func' options yet, needs work.
2025-03-14 07:28:11 +01:00
Yorhel
64a105e013 Validate: remove a level of indirection 2025-03-14 07:27:59 +01:00
Yorhel
9685287523 Version 0.3 2025-03-10 12:43:02 +01:00
Yorhel
d9d2ad0434 Pg: Add COPY support 2025-03-10 12:32:14 +01:00
Yorhel
17176738a0 FU: Support multipart file uploads + some doc fixes
API is not super convenient and implementation is lousy, but uploading
files is not a super common operation so that should be fine.

At least it supports large files with only a single in-memory copy.
2025-03-08 14:06:10 +01:00
Yorhel
e5755ddd80 Validate: Human-readable error messages 2025-03-06 10:16:14 +01:00
Yorhel
e4b6b77e1b Validate: rename rmwhitespace to trim and use builtin::trim() 2025-03-05 15:39:49 +01:00
Yorhel
cbebc3a21e Validate: Rework API, ->validate() now throws error instead of result object
This is a slight simplification and removes the need to pass around
partially normalized data. I've never found a use for the unsafe_data()
method.
2025-03-05 15:35:23 +01:00
Yorhel
f09a103c53 Some test portability fixes again + minor changes 2025-03-02 10:10:35 +01:00
Yorhel
3fd424c6e3 Compat fixes + 0.2 release 2025-02-28 14:05:48 +01:00
Yorhel
15954f4ad5 Pg: Add "$hex" pseudo-type 2025-02-28 13:49:07 +01:00
Yorhel
baf0f90bd5 Pg: Add "time" type, change default format of "date" type but support "$date_str"
Using a consistent numeric interpretation for timestamps, dates and
times simplifies a bunch of operations. It certainly simplifies
conversion between the Postgres formats.
2025-02-28 13:03:16 +01:00
Yorhel
0734bc4991 Pg: Skip query preparation when we can 2025-02-28 12:33:30 +01:00
Yorhel
4686097d00 Pg: Support custom type overrides with callbacks 2025-02-28 11:23:42 +01:00
Yorhel
327fd9ea50 Pg: Support type override configuration 2025-02-27 18:24:14 +01:00
Yorhel
3662931fc2 FU: Add "denied" and "notfound" convenience methods 2025-02-27 14:00:28 +01:00
Yorhel
b06cc24826 FU: Add super awesome and butt-ugly FU::debug_info web interface
This is so much more useful than embedding debugging info inside pages,
as I've been doing before.
2025-02-27 13:44:25 +01:00
Yorhel
0c59b56ee8 Minor doc & portability fixes 2025-02-26 08:06:57 +01:00
Yorhel
7b0ba45346 Docs, compatibility fixes again, 0.1 release 2025-02-25 17:02:33 +01:00
Yorhel
69262992ca FU::Validate: Add module + integrate with FU
Copied from TUWF::Validate with a few small changes. I have a few more
features planned, but let's see how this goes first.

It's been an incredibly useful module in the past, I'm not sure right
now if I had ideas for potential improvements at some point, will need
to check notes.
2025-02-25 14:31:38 +01:00