Kristaps Dz
8b35a20d1a
Use proper warning function.
2021-09-23 15:38:01 +02:00
Emil Engler
d108cbc4e6
Check for snprintf(3) failure.
...
The function must always return a 3.
If we get a different number or even a negative one indicating an
unlikely but possible error in the printf-engine we will probably
get into trouble.
2021-07-26 17:12:03 +02:00
kristapsdz
1506748adf
Add bearer authorisation.
2021-05-08 13:04:11 +00:00
kristapsdz
0f7f5071ab
All kxsocketpair() callers use the same arguments, so don't pass them.
2020-07-17 14:03:24 +00:00
kristapsdz
ee09bfac8a
Remove XASPRINTF and XVASPRINTF, make return checks for -1, make exported
...
wrapper functions consistent in error handling.
2020-07-17 13:58:05 +00:00
kristapsdz
ecc091c29b
Replace XMALLOC and XCALLOC and use some style(9) while there.
2020-07-17 13:32:36 +00:00
kristapsdz
05f95f41ab
Remove the XREALLOC and XREALLOCARRAY functions. Plug a small memory leak
...
when unable to reallocate kpairs.
2020-07-17 13:14:44 +00:00
kristapsdz
d77e5db1dc
Remove XSTRDUP macro and remove superfluous line/file bits from kxstrdup.
2020-07-17 13:09:23 +00:00
kristapsdz
d2a2f7456d
Move from XWARN[X], clean up some logic, remove some superfluous error messages.
2020-07-17 12:15:01 +00:00
kristapsdz
6a4da3bde8
Provide safer, more meaningful datetime conversion functions. These use
...
timegm(3) as the underlying mechanism instead of relying on hand-rolled functions.
They improve upon timegm(3) in not having ambiguous return values.
Also add regression tests for all new functions.
2020-05-05 10:26:55 +00:00
kristapsdz
8184cb35cd
Deprecate kutil_urldecode and kutil_urldecode_inplace for khttp equivalents.
...
These are the same except they handle a NULL dst properly.
2020-04-10 11:51:07 +00:00
kristapsdz
aa961a734d
Re-name kutil_urlencode to khttp_urlencode, the only difference being handling
...
of NULL values (return now as empty strings instead of ambiguously erroring out).
This flushed out some errors in the regression suite with invalid
parameters. Add regression test with fuller testing.
2020-04-10 10:24:39 +00:00
kristapsdz
f7130d4b3e
Break out query string formatter for urlpart/urlabs. Add khttp_urlabs, which
...
replaces kutil_urlabs but is significantly more robust.
2020-04-09 11:00:05 +00:00
kristapsdz
c39828615b
Add renamed khttp_urlpart and family, which in form is like kutil_urlpart
...
except without the "struct kreq". It also adds khttp_vurlpart et al., which
exposes the va_list interface.
The new functions have two small behaviour difference: if the MIME suffix
is an empty string, the dot-suffix is not printed; and if the page is NULL,
it is simply not printed as if it were an empty string. Furthermore, an
empty or NULL page does not print the MIME suffix too. This makes output
conform to URL standards.
The old functions are left with the existing behaviour *except* that the
MIME suffix is not printed if the suffix is an empty string.
2020-04-08 13:31:16 +00:00
kristapsdz
d1dbe9c066
Add a new error value, KCGI_WRITER, for when the writing functions have
...
syntactic errors (e.g., a JSON named object opened in an array context).
These were earlier KCGI_FORM, but this error code already has different
meaning.
2020-03-27 10:12:00 +00:00
kristapsdz
93aac1eefc
Clarify what happens if buffers are NULL or zero-sized. Add regression tests
...
to test behaviour.
2020-03-22 12:46:24 +00:00
kristapsdz
eeff938eb2
Revert void-casting. We're locked into the existing API of all other writes.
2020-03-22 11:00:14 +00:00
kristapsdz
4d889b9745
Use "const void *" instead of "const char *" to reflect that this is binary data.
2020-03-22 10:15:01 +00:00
kristapsdz
0d08f55654
Add kcgi_buf_printf, use XREALLOC instead of realloc in kcgi_buf_write,
...
add regression tests for kcgi_buf_printf, sync write regression and buffer
regression, test for NUL terminator in buffer.
2020-03-22 09:49:44 +00:00
kristapsdz
42f9c8627d
Both relax and tighten the email parser. Relax in not checking the accepted
...
characters and in allowing min. 3 bytes (e.g., a@b) instead of 5. Relax in
not checking characters beyond existence of a non-border at sign. Tighten in
check for border at-sign.
2020-02-10 13:37:48 +00:00
kristapsdz
cc9783e1a3
Make sure to call va_end() for every va_start().
2020-02-10 12:28:18 +00:00
kristapsdz
5fa96b21dd
Extensive style(9).
2020-02-10 12:24:24 +00:00
kristapsdz
ec7ecfd8e7
Add kvasprintf().
...
Part of https://github.com/kristapsdz/kcgi/pull/79
2020-02-10 09:15:48 +00:00
kristapsdz
5f0cf3f319
style(9). Merge a GitHub pull with many improvements---thank you!
...
First, has url encoder emit uppercase as suggested by rfc 3986. Brings
in optimisations that speed up URL decoder. Makes some invocations
disallowed. Adds disallowed invocations to regression suite.
Fixes https://github.com/kristapsdz/kcgi/pull/70
2020-01-08 14:54:55 +00:00
kristapsdz
60c529ce28
Handle NULL values properly.
2018-12-27 17:03:41 +00:00
kristapsdz
4d478fe2db
Apply style(9), use XSTRDUP instead of strdup, remove documentation that's
...
been pushed to manpage (external function).
2018-12-26 17:57:46 +00:00
kristapsdz
29b9654826
Merge https://github.com/kristapsdz/kcgi/pull/54
2018-12-26 17:53:44 +00:00
kristapsdz
9726880e6f
Fix minor scan-build nits.
2018-09-28 14:28:36 +00:00
kristapsdz
e5389dab78
Get rid of all allocation/free of sandbox resources, which was only used by
...
systrace.
2018-09-28 14:21:08 +00:00
kristapsdz
6746ead36f
Remove the argument to sandboxers, as that was only used by systrace.
2018-09-28 14:16:06 +00:00
kristapsdz
fc16574dee
Remove parent configuration of sandbox, as only systrace used it and our
...
systrace support is no more.
2018-09-28 14:08:07 +00:00
kristapsdz
0688b4e4ba
Add application/xml MIME type. We still use TEXT_XML as the default map
...
from .xml suffixes, but this is a start for getting a fix in for
https://github.com/kristapsdz/kcaldav/issues/88 . Thank you!
2018-06-18 14:12:11 +00:00
kristapsdz
fb8724f032
Fix from Ross Richardson to prevent high-bits from being printed as signed. Thanks!
2018-05-30 13:53:39 +00:00
kristapsdz
bb12b8185a
Clean up kutil_invalidate() primarily as suggested by schwarze@, thanks!
2018-04-19 18:39:36 +00:00
kristapsdz
dc1cb55513
style(9)
2018-04-18 21:08:22 +00:00
kristapsdz
c926852dd4
Add kcgi_strerror(3).
2018-04-17 18:07:56 +00:00
kristapsdz
7a5342ef53
Required for fcgi.c now.
2018-04-09 22:53:01 +00:00
kristapsdz
d4610b6a67
As part of the migration to kcgi, use the proper prefix. Also make sure that
...
these return the correct enum value to be used as kwriters.
2018-03-05 08:31:10 +00:00
kristapsdz
2d91508b4f
Remove confusing assignment.
2018-01-18 08:35:39 +00:00
kristapsdz
58ffd19b84
Fix from schwarze@: memory leak in khttp_free. Thank you!
2018-01-18 07:54:50 +00:00
kristapsdz
6501360bef
Allow for relative URLs with a NULL path.
2018-01-18 06:50:59 +00:00
kristapsdz
c3786f60b0
Make kutil_part behave exactly like kutil_partx. Pointed out by schwarze@---thanks!
2018-01-18 06:22:55 +00:00
kristapsdz
565bc35a90
Error out on a bad switch statement. From schwarze@ --- thanks!
2018-01-18 05:52:44 +00:00
kristapsdz
a6a4d33d6a
As noted by schwarze@, the temporary buffer in kutil_urlencode can be removed.
...
Thanks! While here, add a test suite for the URL encoding facility.
2018-01-18 05:49:15 +00:00
kristapsdz
6428a69118
Double validation: first, don't let underflow through. Second, save errno
...
and restore on success. Third, properly trim() string to prevent ending
whitespace from invalidation. Remove superfluous check for empty string and
re-add it for the trimmed version. Most of this in a suggestion by schwarze@,
thanks! (Also add a small one-liner for easier reading of udouble, also by
schwarze@.)
2018-01-04 10:32:03 +00:00
kristapsdz
f7d5576af6
Introduce functions for validating broken-down dates and times.
2018-01-04 04:57:36 +00:00
kristapsdz
303be32dfc
Additional month/day restrictions noted by schwarze@ and make sure that our
...
calendar date is Gregorian.
2018-01-04 04:12:10 +00:00
kristapsdz
2b010d99e8
Test that dates via kvalid_date() are checked for correctness. Note this in
...
the manpage. Add a regression test as well.
2018-01-03 08:17:11 +00:00
kristapsdz
60d65adc79
Merge simplifying patch from schwarze@---thanks!
2018-01-03 07:24:46 +00:00
kristapsdz
855475e1d3
Simplify trim(), from a patch by schwarze@. Thanks!
2018-01-02 10:54:45 +00:00