66 Commits
Author SHA1 Message Date
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 92c0cef530 Remove last vestiges of XWARN[X] from system and remove the macros too. 2020-07-17 12:54:03 +00:00
kristapsdz ed3889ae5c Convert wrappers.c to using kutil_warn-style functions instead of the macro
wrappers.  Use style(9).  Remove an unused function.  Clarify docs.
2020-07-15 08:32:43 +00:00
kristapsdz da43c0ea40 Switch to using kutil_warn and kutil_warnx for the XWARN and XWARNX macros.
This removes the old kxwarn[x] functions that didn't do much and did it poorly
at that.  This shouldn't affect any callers unless they depend on backend logging
formats, which is undocumented anyway.
2020-07-14 11:23:47 +00:00
kristapsdz f4098a0f69 Use compiler attributes for some functions. 2020-03-21 14:31:34 +00:00
kristapsdz 5cfabb3593 ifdef -> if 2020-03-16 00:00:45 +00:00
kristapsdz 69f2c319b8 No more systrace. 2018-09-28 14:24:30 +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 7a5342ef53 Required for fcgi.c now. 2018-04-09 22:53:01 +00:00
kristapsdz 60e0eba3a6 Have writing function return kcgi_err. 2018-03-25 05:41:58 +00:00
kristapsdz 9f6e417ce7 Make writer-disable interface public. 2018-01-14 04:02:33 +00:00
kristapsdz 26a47a926e Introduce an API for controlling output. Such a mechanism was suggested by
schwarze@ as part of an on-going audit.  This API sets the basis for controlling
the write behaviour of front-end APIs like kcgijson.  It is still being
developed.  The theory is that front-end APIs are allocated, then further
front-ends disabled from allocation, restricting output to a given format.
The original khttp_write and friends are to be deprecated in favour of a raw-mode
output frontend.
2018-01-12 14:27:57 +00:00
kristapsdz 00e6b824e0 As suggested by schwarze@, move output functions into output.c. Thanks! 2018-01-02 05:14:08 +00:00
kristapsdz 35a3cbb10d Check in forgotten bits. 2017-10-17 00:06:44 +00:00
kristapsdz 271c209daf Add a fullreadword() that has a size parameter. 2017-10-16 22:29:18 +00:00
kristapsdz 05b24543cd Fix misspellings, https://github.com/kristapsdz/kcgi/pull/17 2016-12-30 10:46:21 +00:00
kristapsdz f1698232a9 Slightly modified patch from https://github.com/kristapsdz/kcgi/pull/12 -- thanks! 2016-10-31 22:02:37 +00:00
kristapsdz 72514a316e Push control choices into sandbox and fix FreeBSD's sandbox handling. 2016-03-16 04:20:33 +00:00
kristapsdz 38c6d16eae Split apart a SAND_CONTROL with SAND_CONTROL_OLD and SAND_CONTROL_NEW,
the first being the "usual" FastCGI, the second being our new version.
Next, fix how FastCGI exits in the event of its child: this required
pushing logic into parent.c that properly detects when a read exits due
to EOF, which is allowed for CGI.
2016-03-15 03:45:55 +00:00
kristapsdz 0106ebd441 Allow an extension to FastCGI indicated by an environment variable set in
application clients.  This stipulates that clients should read a file
descriptor from their control socket instead of accepting a file descriptor.
Then add a "variable pool" mode to kfcgi(8) that accepts descriptors and
passes them in the aforementioned way.  This allows for growable pools of
application clients.
2016-03-12 08:51:34 +00:00
kristapsdz 92a494a2ab Prepend all "x" functions (e.g., xmalloc) with a "k".
This avoids overriding external xmalloc() functions that are weakly declared.
Pointed out by Okan Demirmen--thanks!
2016-02-11 19:19:23 +00:00
kristapsdz d4ebc1b5d7 Add support for a send buffer.
This will buffer writes (from khttp_write) into a pre-allocated buffer
that flushes when the buffer is full or at exit.
This change requires khttp_parsex() and khttp_fcgi_initx() to accept a
new parameter, a structure consisting of (right now) just the send buffer size,
which will later be filled in with tunables.
2016-02-08 21:55:29 +00:00
kristapsdz 4b6585db76 Add HTTP digest support. This was [mostly] pulled in from kcaldav. 2016-01-07 00:18:29 +00:00
kristapsdz a269537b12 Copyright updating. 2016-01-04 22:28:31 +00:00
kristapsdz d5cc327c26 Add some debugging flags to khttp_parsex and khttp_fcgi_initx.
This allows the read and write operations themselves to be logged for
analysis.
2016-01-04 21:48:35 +00:00
kristapsdz ba950964f7 Replace tame(2) with pledge(2). From a patch by James Turner--thanks! 2015-11-12 19:58:10 +00:00
kristapsdz d3294a5173 On Mac OS X 10.7.5 (at least?), poll(2) returns 0 (timeout) even though
we request a blocking wait without timeout.
I've submitted a bug report for this, but work around it in the
meantime.
2015-09-04 21:07:23 +00:00
kristapsdz d1e85116c6 Add initial tame(2) sandbox. 2015-08-06 20:11:09 +00:00
kristapsdz 70cc1e2a99 Compilation on Linux. 2015-08-02 21:20:27 +00:00
kristapsdz 8ae199f806 Compilation on OpenBSD. 2015-07-26 18:22:36 +00:00
kristapsdz b1da7a0fbd Initial attempt at putting control socket into a sandbox. 2015-07-19 08:52:24 +00:00
kristapsdz e05a5212ac Add forgotten descriptor close that caused hangs. 2015-07-18 10:04:16 +00:00
kristapsdz 0e3e8157b3 Kick out kworker interface, which was getting a little awkward. 2015-07-18 09:55:21 +00:00
kristapsdz dde0ef8f82 Kick out "struct worker" for the FastCGI interface. 2015-07-17 15:35:15 +00:00
kristapsdz ed09410a72 Initial check-in of process-separated controller.
This process manages the FastCGI socket directly and delegates connections
to both the worker and the application parent.
2015-07-17 13:29:50 +00:00
kristapsdz d02d55bba6 Lots of tuning of kworker exit sequence so as not to leak file descriptors
or the fact of those descriptors.
2015-07-16 21:49:48 +00:00
kristapsdz 950d861e02 Turn on FastCGI handling in front-end.
Back-end is now reasonably stable.
2015-07-15 13:33:46 +00:00
kristapsdz eb3bf9b718 Split output writing into output.c to better manage the FastCGI frames. 2015-07-15 11:17:40 +00:00
kristapsdz 44ac7b29f2 More FastCGI scaffolding. 2015-07-14 21:22:55 +00:00
kristapsdz 7980789dba Initial bits for FastCGI.
Trying this all again...
2015-07-14 17:45:47 +00:00
kristapsdz 930ecf054e More seccomp filter work. 2015-07-07 10:36:02 +00:00
kristapsdz d1587fed60 Move around some code for clarity (no functional change).
Remove some unused functions.
2015-04-10 09:27:34 +00:00
kristapsdz 64ad87a20c Add initial (untested) support for HTTP authorisation token parsing,
specifically digest parsing.
Ported from kcaldav, http://kristaps.bsd.lv/kcaldav.
2015-04-08 21:12:25 +00:00
kristapsdz 8fa2dd33ac Check in more FastCGI. This doesn't touch the outward-facing API and
is still in development.
2015-02-10 10:18:02 +00:00