103 Commits
Author SHA1 Message Date
kristapsdz 1506748adf Add bearer authorisation. 2021-05-08 13:04:11 +00:00
kristapsdz d184086ee7 Copyright. 2020-07-21 12:58:42 +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 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 65b4d015b2 Replace XWARN[X] with kutil_warn[x]. Sprinkle style(9) liberally. 2020-07-16 13:15:03 +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 a395446859 Rename sun -> un so as not to trample SunOS macro. Don't use LOG_PERROR if
it doesn't exist.  Don't use sun_len if it doesn't exist.
2020-03-15 14:46:33 +00:00
kristapsdz 555dace6bb Don't assume that unaligned memory access is ok. Found when running regress
on a sparc64 provided by Stefan Sperling---thank you so much!
2020-03-14 23:11:39 +00:00
kristapsdz 29b9654826 Merge https://github.com/kristapsdz/kcgi/pull/54 2018-12-26 17:53:44 +00:00
kristapsdz 53db040cbe Const-ify and fix a check for "buf" when it should have been "b". 2018-04-10 18:29:00 +00:00
kristapsdz 2342b0c4b2 Don't use "ssz" for this temporary value---we need it! 2018-04-10 18:19:35 +00:00
kristapsdz 906e2791e4 Copyrights. 2018-04-09 19:56:37 +00:00
kristapsdz e431580a7c Respond to the mandatory zero-length frame and write a response code back
to the control.  Also clean up lots of documentation.
2018-04-09 18:51:13 +00:00
kristapsdz 5bf8036f5f Re-write the FastCGI worker handling. This is because connections in the
control socket can be severed at any time, which earlier would result in
the worker exiting, and thus the control socket exiting.  This is the first
working version and contains lots of debugging information.
2018-04-09 00:48:20 +00:00
kristapsdz d622ea04cf Begin in converting child processing for FastCGI into handling recoverable
errors in the FastCGI protocol.
2018-03-29 09:15:52 +00:00
kristapsdz 571636d1b6 Be more descriptive in error condition. 2018-03-26 04:13:54 +00:00
kristapsdz 36004ef4fe Fix RFC 2617 ("auth-int" digest authorisation) as patched by Charles Collicutt.
Source: https://github.com/kristapsdz/kcgi/pull/26 --- thanks!
2018-03-22 07:35:58 +00:00
kristapsdz 09fc01e8c6 Failing validation causes the type to be unset and its parsed value cleared.
Suggested by schwarze@, thanks!
2018-01-04 16:14:03 +00:00
kristapsdz 9eace120f7 Catch the situation where asprintf returns zero. 2018-01-02 10:06:47 +00:00
kristapsdz 61f90d1c21 Simply function. From a patch by schwarze@---thanks! 2018-01-02 07:18:38 +00:00
kristapsdz 9f7830d083 Strip warning. 2017-11-29 03:44:08 +00:00
kristapsdz 3533dbdb9c URL-decoding of key vanished: re-add. 2017-11-29 03:43:46 +00:00
kristapsdz de301424fe Deprecate plaintext queries. 2017-11-21 03:07:35 +00:00
kristapsdz db16025520 Fix (again) empty values in urlencoded query strings. Thanks, schwarze@! 2017-11-21 03:04:51 +00:00
kristapsdz fdb66612cd Put check for blank subpart names after OWS syntax check as suggested by
schwarze@---thanks!
2017-11-21 02:31:33 +00:00
kristapsdz a20e187a8d Two finds by schwarze@: clarify language regarding dropped MIME headers and
move check for empty key to include obsolete syntax.  While here, merge his
suggestion about a shorter loop.  Thanks!
2017-11-21 02:29:13 +00:00
kristapsdz f939411735 If the content-type is unset for multiform documents, the RFC defines it as
text/plain.  So do so and make sure that ctypepos is also set appropriately.
Also document that any "mime" array overriding the default should include
text/plain in this event.  This all noted by schwarze@---thanks!
2017-11-21 02:13:49 +00:00
kristapsdz ea84289eaa Don't pass untrusted input to output. Noted by schwarze@---thanks! 2017-11-19 05:16:31 +00:00
kristapsdz 2777d52323 Catch allocation failures as noted by schwarze@. Thanks! 2017-11-19 04:24:26 +00:00
kristapsdz 78d6147aac The various RFCs are silent as to whether we can have empty values within the
query string.  Let them through.  Also add a regression test for the same.
2017-11-19 03:56:39 +00:00
kristapsdz 6a85f3a4cc As noted by schwarze@, we're protected from NULL buffers, so don't check for
them redundantly.  Thanks!
2017-11-19 03:40:34 +00:00
kristapsdz 5e7d64fdeb Better warning messages. 2017-11-19 03:22:46 +00:00
kristapsdz ebbffb5d91 Allow for spaces before the "=" in MIME header subparts. Also allow for
spaces before the ";" following each MIME header subpart.  Both of these noted
by schwarze@---thanks!  While here, enforce that subparts are connected to
a specific kind of MIME field.
2017-11-19 03:15:44 +00:00
kristapsdz c83484d6bd Failure to strdup should lead to exit. 2017-11-19 02:44:47 +00:00
kristapsdz b13d98b800 RFC 822 allows for space before the colon in a MIME header. However, later
RFCs don't, but explicitly note that obsolete syntax should be supported.
Thus, strip away whitespace before the colon.  Noted by schwarze@, thanks!
While here, put mime_free in the correct place.
2017-11-19 02:40:58 +00:00
kristapsdz b37ee382c9 Replace nil -> NUL as noted by schwarze@---thanks! 2017-11-19 01:16:58 +00:00
kristapsdz 0bcebdc76a Move mime_free into mime_parse and remove a superfluous memset. Noted by
schwarze@---thanks!
2017-11-19 01:13:25 +00:00
kristapsdz e96f7f5f71 Possibly read after buffer boundary found by schwarze@---thanks! While here
clarify some warning messages.
2017-11-19 00:17:09 +00:00
kristapsdz 553676e193 Fix a bug found by schwarze@: if we have white-space between the trailing
boundary marker and the CRLF, we might read after the end of our buffer.
While here, add some normalising white-space and fix up warning messages to
be more meaningful.
2017-11-18 13:20:13 +00:00
kristapsdz be6190cbc5 Use XASPRINTF instead of asprintf as noted by schwarze@---thanks! 2017-11-18 11:24:12 +00:00
kristapsdz d017a98eee Declare a stack variable instead of re-purposing an unusued parameter and also
mention why we're not warning about trailing garbage.  Both of these noted by
schwarze@---thanks!
2017-11-18 11:03:40 +00:00
kristapsdz f1c2a37f7d As correctly noted by schwarze@, use the proper function for this loop. Thanks! 2017-11-18 10:40:05 +00:00
kristapsdz 01aa9814a6 As noted by schwarze@, add in warnings for RFC violations. Thanks! 2017-11-18 10:34:40 +00:00
kristapsdz 00a4376dcf Add a MD5Updatec macro to avoid type warnings. 2017-10-18 21:51:05 +00:00
kristapsdz 685abdeced Full switch to oconfigure instead of current system, so remove all of the
test and compat files.  These are now in tests.c and compats.c, and driven
by the configure script.   Also remove the MD5 code, which is part of
compats.c.  Lastly, move ifdefs to ifs, remove defined (same), and also
remove HAVE_CONFIG_H.
2017-10-18 21:36:59 +00:00
kristapsdz 041ba58542 Use fullwriteword() instead of a fullwrite() dance, as suggested by schwarze@.
While here, also improve the documentation for the output() function and also
fullwriteword() itself.
2017-10-18 20:03:19 +00:00