summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-02-24Fix doc typoHEADmasterYorhel1-1/+1
2023-10-14Validate: stricter schema validation + cleanupYorhel3-6/+19
This caught a few bugs in my tests, but didn't trigger anything in the VNDB codebase.
2023-10-10Validate/BREAKING CHANGE: "default" implies not "required", +"missing" ↵Yorhel5-69/+89
validation The "required" validation has always been a bit iffy as it doesn't say anything about what should happen with optional fields. An optional field without an explicit "default" could either be undef or an empty string, but I found only a single place in the VNDB codebase where that is the behavior that I wanted - in many other places I has assumed that the frontend would give me the correct type. The point of input validation is to handle untrusted input, so I figured a breaking change to properly fix these cases was warranted. Also added a "missing" validation so that it's possible to distinguish between each type of optional value. The VNDB API needs this for PATCH requests.
2023-08-06Add some more image formats to the default MIME typesYorhel1-0/+3
2023-05-04TUWF::XML: add <menu> HTML5 tagYorhel2-2/+2
2023-04-27Validate: avoid \d in numeric regex testsYorhel2-4/+4
Since they can match Unicode numbers outside of the ASCII range, which will rarely be interpreted correctly.
2023-04-04Add .mjs to default mime typesYorhel1-0/+1
2023-03-30resJSON(): Set convert_blessed option to check for TO_JSON() methodsYorhel1-1/+1
2023-01-18Version 1.5v1.5Yorhel10-9/+37
2023-01-11Response: Proper support for HTTP 204 No Content responsesYorhel1-3/+8
2023-01-11Fix accepting DELETE requestsYorhel1-1/+1
2022-12-18TUWF::Request: Remove old unicode error catching codeYorhel1-2/+0
That error was thrown by the Encode module, but that's not being used anymore.
2022-12-13Use Perl built-in utf8 functions rather than "Encode" moduleYorhel3-24/+27
Should slightly improve startup times and memory use.
2022-10-12Remove useless path traversal warning from resFile()Yorhel1-1/+0
2022-10-11TUWF::Validate: Fix input modification on {unknown=>"reject"}Yorhel2-3/+9
2022-10-07Add support for output compression to resJSON, resFile and resBinaryYorhel2-21/+27
2022-08-03Log warning and return a 404 in resFile() path traversal attemptYorhel1-2/+6
This is nicer and less verbose than throwing a 500.
2022-02-15Add "db_connect" hookYorhel3-2/+10
And move the "ping failed" warning to *after* the reconnect has been done, since the logging function may attempt to access the DB.
2022-02-15TUWF::XML: Add <summary> html5 tagYorhel2-4/+4
2021-12-05Do a graceful shutdown on SIGTERM/INT in fastcgi modeYorhel1-1/+2
"graceful" meaning quit after processing the current request. Now I can safely kill fastcgi processes to reload the code without missing even a single request. \o/ Tested in production.
2021-12-04Add fastcgi_max_requests optionYorhel2-0/+8
2021-11-29Validate: Add "undefbool" default templateYorhel3-1/+8
A useful template I've been using for VNDB. With proper TUWF integration it now works better with Validate::Interop as well.
2021-10-28Disallow IP-based email addresses in validationYorhel3-5/+5
Technically a breaking change, but nobody's ever given me an IP-based email so I doubt anyone will notice.
2021-07-09TUWF::XML: Add support for undef and concat attributesYorhel3-4/+26
Undef attribute values exclude the attribute, this is useful in many cases, e.g. input type => 'checkbox', checked => $checked ? '' : undef; Likewise, and in combination with undef attributes, concat attributes are useful for dynamically setting classes: div '+class' => 'box', '+class' => $important ? 'warn' : undef; The '+' prefix is invalid in XML and HTML, so can be safely used for this context. Other prefixes can be added later, too. I had thought of using a '?' prefix for boolean attributes, but using '' and undef kinda works well enough.
2021-06-26Validate::Interop: Fix Elm decoder for single-key objectsYorhel1-2/+2
2021-02-22TUWF::Validation: Allow CODE references for default and onerror optionsYorhel3-2/+15
2020-12-25Add tuwf->captures() convenience methodYorhel2-0/+15
2020-12-25Allow using database methods during initialization + lazily load DB connectionYorhel2-10/+15
2020-12-25Fix logging during initializationYorhel1-3/+5
2020-07-29TUWF::Response: Properly UTF-8 encode headersYorhel1-2/+3
Non-ASCII headers aren't exactly common, but they can happen and should be encoded properly.
2020-05-27Detect and break recursion in log_formatYorhel1-1/+4
2020-04-20Add tuwf->req() function to store request dataYorhel2-0/+18
This is more reliable than using before or after hooks to set/unset global state, since with those the order of initialization can matter and options like `log_format` may be run outside of those hooks. (Totally untested)
2020-03-29Add workaround for SIGCHLD bug in HTTP::Server::SimpleYorhel1-0/+5
2020-03-15TUWF::Validate::Interp::elm_decoder(): Support structs with more than 8 fieldsYorhel1-12/+39
2020-01-11TUWF::XML: Add xml_string() function + simple test scriptYorhel4-1/+47
2019-12-05TUWF::Validate: Add "onerror" built-in validationYorhel3-6/+25
2019-11-01dbPage: Just return the result list in scalar contextYorhel2-8/+9
This makes dbPage() useful even if you don't need its logic to determine whether there's a next page.
2019-10-01Typo fix in TUWF::Validate docYorhel1-1/+1
2019-10-01Use normal request/response flow for 404 errorsYorhel1-2/+1
i.e. don't throw an exception if no handlers matched. This way the error_404_handler is called before all the `after` hooks are run, as one would expect. The `error_404_handler` setting is the only one without a big WARNING message in the documentation, so it ought to behave like a normal route.
2019-09-08resCookie: Add support for Max-Age and SameSite propertiesYorhel2-6/+22
2019-08-15Add support for JSON::PP and Cpanel::JSON::PPYorhel6-10/+26
Mainly motivated by the fact that JSON::PP is now in core, so that's one less dependency. Cpanel::JSON::PP is supported because some people like it and to avoid loading multiple JSON modules in a single process. TUWF prefers whatever module is already in memory, so if you load JSON::PP at any point before using TUWF's JSON functionality you will not benefit from the XS performance.
2019-07-29Add TUWF::Validate::Interop::elm_decoder()Yorhel1-0/+52
2019-07-06Alright then, have it your way, version 1.4v1.4Yorhel10-9/+12
2019-07-06Version 1.3.1v1.3.1Yorhel10-9/+12
2019-07-06Fix testsYorhel2-2/+2
TBH I'm not sure why some tests failed on loading Cpanel::JSON::XS::Type, did they not have a recent enough version of Cpanel::JSON::XS installed or is my eval-skip-thing not working? ...so I'm not entirely sure if this fixes it.
2019-06-17Year + version bump for 1.3v1.3Yorhel21-20/+36
2019-02-09Fix TUWF::Misc::validate() in multiple value modeYorhel1-1/+1
2018-08-31Add option to write mail()s to the logYorhel2-1/+6
Useful when developing.
2018-08-31TUWF::Validate::Interop: Don't escape @ in html5_validation() patternsYorhel1-1/+5
2018-08-25TUWF::Validate::Interop: Update elm_type() for Elm 0.19Yorhel1-2/+2