127 Commits
Author SHA1 Message Date
kristapsdz 12c1d9d7db Add tests for bearer validation and do some style(9). 2021-05-12 10:07:32 +00:00
kristapsdz cb1d14d0d7 CURLOPT_BEARER isn't always defined. 2021-05-12 10:01:05 +00:00
kristapsdz bd4fdbce9b Add tests for bearer authorisation. 2021-05-08 13:20:25 +00:00
kristapsdz d239abaa20 Cast to silence compiler warning. 2021-01-20 22:23:20 +00:00
kristapsdz ee12f2da1f Make sure we're not doing pointer arithmetic with an int64_t size. Thanks
to A. Tammy for providing a system for this problem to be diagnosed and fixed!

Fixes https://github.com/kristapsdz/kcgi/issues/88
2021-01-20 22:16:10 +00:00
kristapsdz 15a2db7654 Make sure that multiple similar keys only select the first. 2020-10-17 10:36:23 +00:00
kristapsdz 3aa6e4f74a Make sure abutting escape works. 2020-10-17 10:32:47 +00:00
kristapsdz 409cb9ab69 Check for empty key sequences. 2020-10-17 10:30:06 +00:00
kristapsdz 588fae1f11 Finalise on debug logging format, switch writes debugging to use kutil_info.
In doing so, switch to a static line buffer and simplify a lot of code used
for writing.
2020-07-21 10:44:27 +00:00
kristapsdz e6e70507c5 Use regular logging functions for KREQ_DEBUG_READ_BODY. 2020-07-20 13:22:11 +00:00
kristapsdz 663f5cb0d7 Move log parsing into regress.h. 2020-07-20 12:57:29 +00:00
kristapsdz caad776555 Modernise with style(9) and err(3). 2020-07-20 10:14:20 +00:00
kristapsdz 628724ad60 Test that error logging exits the process. Also fix for WEXITSTATUS. 2020-07-14 11:18:19 +00:00
kristapsdz 2758874528 Use the results of random or arc4random instead of constantly erroring out
in the native conversion.
2020-05-11 14:08:28 +00:00
kristapsdz 59730c5e94 Cover more of the possible 64-bit time space. 2020-05-11 11:46:31 +00:00
kristapsdz 5a2e7ec57f Test over the full range of int64_t possible dates. 2020-05-11 11:15:15 +00:00
kristapsdz 14f51be89c Add debugging. 2020-05-11 11:02:16 +00:00
kristapsdz 28e3b39929 Typo fix. 2020-05-11 10:56:43 +00:00
kristapsdz 11e21bfa61 Add simple regression for khttp_epoch2datetime. 2020-05-10 16:24:21 +00:00
kristapsdz 7b52236d6a For 32-bit time_t, don't assign to "v", which will wrap the 64-bit tests. 2020-05-10 09:19:34 +00:00
kristapsdz 7ad85de7b2 Update manpages to mention UB for dates with year beyond INT_{MIN,MAX}. Also
add regression tests for inputs beyond INT_{MIN,MAX} and >4 digit years.
2020-05-10 08:45:17 +00:00
kristapsdz ea143bc850 timegm can legit return error here, so ignore it. 2020-05-06 22:18:20 +00:00
kristapsdz 74f95d783e Have the date2epoch check use native time for its tests more intelligently
to avoid casting between int64_t and time_t.
2020-05-06 22:08:49 +00:00
kristapsdz a866b92bcd Add some more tests. 2020-05-06 13:36:07 +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 58e2e73fa5 Add test for KHTTP_EPOCH2TM. 2020-04-24 12:48:41 +00:00
kristapsdz ff869b7beb Write tests for new functions khttp_epoch2xxx, move existing tests to
deprecated test file.
2020-04-24 12:43:13 +00:00
kristapsdz dba9422e8a Document new khttp_urldecode family, throwing away old manpage entirely.
Add new urldecode regression test, which is basically just a copy of the old.
2020-04-10 11:53:23 +00:00
kristapsdz 5850c23e8f Check for both lowercase and uppercase encoding styles.
Add some strings.
2020-04-10 10:58:07 +00:00
kristapsdz 85aeac0dac Add tests for NULL/empty string query string value behaviour. 2020-04-10 10:28:21 +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 b430c1e084 Add examples (and verify they work). 2020-04-09 16:22:12 +00:00
kristapsdz dde4492390 Add manpage and regression test for khttp_urlabs. 2020-04-09 11:00:45 +00:00
kristapsdz ef353ea094 Add new manpage. 2020-04-08 13:50:33 +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 7d36f7dfe2 Add regression tests for backing out nonexisting scopes. 2020-03-27 22:17:10 +00:00
kristapsdz b0b5e2e801 Have khtml_puts() not bail on NULL value and regress test it. 2020-03-27 22:02:17 +00:00
kristapsdz 9f4636cff4 Add regression test for void/instruction elements. 2020-03-27 21:54:03 +00:00
kristapsdz 0af3d9a67d Handle more corner cases. 2020-03-27 10:58:35 +00:00
kristapsdz fc1db72f16 Add test for disabled HTML failure and make simple HTML test more interesting. 2020-03-26 10:10:26 +00:00
kristapsdz 6364df8f8c Merge support for khtml_printf provided by Tracey Emery, thanks! Patch
tweaked for correct manpage invocation.  Merging a simple HTML test at
the same time.

Fixes https://github.com/kristapsdz/kcgi/pull/82/files
2020-03-25 20:49:42 +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 e68d6e657f Split manpage for buffers into several manpages. 2020-03-22 10:26:53 +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 e86dd54272 Split khttp_write manpage into putc and puts, add more regression tests,
behave more like putc when it comes to casting.
2020-03-21 15:34:04 +00:00
kristapsdz 3cd11fb441 Add khttp_printf plus manpage and regression test. 2020-03-21 14:56:01 +00:00
kristapsdz 021e19bbae Add regression test for all built-in request headers. 2020-03-21 14:12:32 +00:00
kristapsdz 94c3b18899 Use correct idioms for not running w/o zlib. 2020-03-16 00:01:06 +00:00
kristapsdz fc200660ad Add kutil_urlpartx tests (same as kutil_urlpart). Add additional tests for
URL encoding and decoding parts.  Add example usages for these functions to the
manpage.
2020-03-04 22:55:12 +00:00
kristapsdz 8fcfcf6e04 Add some regression tests for logging. 2020-02-17 22:39:01 +00:00