Commit Graph

1306 Commits

Author SHA1 Message Date
Joris Vink c12f296743 missing EPOLLRDHUP check since event loop rework 2018-10-10 14:33:26 +02:00
Joris Vink c463ecb3cb Changes to the event loop inside of Kore.
Now anyone can schedule events and get a callback to work as long
as the user data structure that is added for the event begins
with a kore_event data structure.

All event state is now kept in that kore_event structure and renamed
CONN_[READ|WRITE]_POSSIBLE to KORE_EVENT_[READ|WRITE].
2018-10-09 19:34:40 +02:00
Joris Vink 2449a86085 missing addrtype -> family renames 2018-10-08 20:12:25 +02:00
Joris Vink 884d6d722e add listener to the list earlier. 2018-10-07 21:25:00 +02:00
Joris Vink 19044919b2 don't set nodelay on unix listener sockets 2018-10-07 21:21:37 +02:00
Joris Vink 20c4036e5f add bind_unix configuration option to example conf 2018-10-07 21:08:04 +02:00
Joris Vink 9427ed8a2e rename unix to sun 2018-10-07 21:03:12 +02:00
Joris Vink 442bdef79b allow kore to bind to unix sockets via bind_unix. 2018-10-07 20:49:16 +02:00
Joris Vink f87624a459 Add missing KORE_NO_TLS guards.
Fixes NOTLS=1 builds on openssl 1.1.1
2018-10-01 10:36:33 +02:00
Joris Vink 7db3e4d946 fix compare match on db name.
from Kevin Lam via patches@
2018-09-19 07:18:46 +02:00
Remy Noulin bfffa2d68d update kore.conf.example keymgr configuration 2018-09-10 09:01:05 +02:00
Joris Vink ba8d6301b3 style 2018-08-30 09:13:11 +02:00
Joris Vink 566fefd031 do not http_argument_urldecode for multipart data. 2018-08-16 14:11:28 +02:00
Joris Vink 754ba47cc4 shuffle stuff around so we're not hitting bad juju. 2018-08-13 13:07:32 +02:00
Joris Vink 8d3f73bc71 call fatalx() instead of fatal() in certain cases. 2018-08-13 13:01:27 +02:00
Joris Vink b0074ba45e Add fatalx().
If a worker process dies it automatically gets respawned by the
parent process, but sometimes you want the entire server to go down
if a worker encounters an error. This is what fatalx() does.

Calling fatalx() from a worker process will initiate a full shutdown
of the kore server you are running under.
2018-08-13 09:53:49 +02:00
Joris Vink cf92097bc2 log what dir we can't chdir() into. 2018-08-13 09:53:38 +02:00
Joris Vink 6ef8d59f7d more directly include assets.h 2018-08-13 09:16:28 +02:00
Joris Vink d1c8f95590 Show the reason why regcomp() failed if it does. 2018-08-10 08:06:09 +02:00
Joris Vink 03b927dd64 missing EPOLLET when we reschedule read/write 2018-08-01 12:17:16 +02:00
Joris Vink a927acb7ee Add pledge support under OpenBSD.
All worker processes will now call pledge(2) after dropping
privileges (even if -rn was specified).

By default Kore will use the following promises:
	"stdio rpath inet error"

If your application requires more privileges, you can add more pledges
by setting them in your configuration using the 'pledge' directive:
	pledge dns wpath
2018-07-31 06:51:34 +02:00
Joris Vink 69922598e7 Missing EV_CLEAR for schedule read/write on BSD. 2018-07-30 15:58:47 +02:00
Joris Vink 5b3cee3428 Use a synchronous query to issue a ROLLBACK. 2018-07-28 22:28:19 +02:00
Joris Vink 43234cd36e be less spammy if stat fails with ENOENT. 2018-07-28 22:27:38 +02:00
Joris Vink f126ba5a86 sprinkle more const around 2018-07-25 09:54:34 +02:00
Joris Vink cf1f624367 let filerefs to operate on ms precision for mtime. 2018-07-24 19:56:36 +02:00
Joris Vink a6e662a805 Add KORE_HTTP_STATE() helper macro.
defines as KORE_HTTP_STATE(f) (#f, f) so we can get a literal representing
the name of the state function which makes debugging a little easier.
2018-07-23 06:14:17 +02:00
Joris Vink 7f820c96e8 Make kore_auth_* public. 2018-07-19 10:28:38 +02:00
Joris Vink 821c1df8ec use method not allowed when required 2018-07-18 16:24:28 +02:00
Joris Vink 916ce222b4 better fix for 5a5d9fd0.
Don't let net_recv_flush() do things as long as the HTTP layer
owns the buffer. When we have sent a response kick the read end
back into gear ourselves by calling net_recv_flush().
2018-07-18 16:10:41 +02:00
Joris Vink 086e2e3d5e len is a size_t, not ssize_t 2018-07-18 16:09:05 +02:00
Joris Vink 25c8dfbdaa missing rpath pledge for openbsd 2018-07-18 15:14:07 +02:00
Joris Vink 5a5d9fd0c2 alloc space for nb->buf after taking ownership. 2018-07-18 14:36:13 +02:00
Joris Vink 27d1746940 Consume all notifications on a connection. 2018-07-18 11:40:59 +02:00
Joris Vink 2e321f14de Add KORE_PGSQL_STATE_NOTIFY.
Issue a LISTEN channel on a kore_pgsql, bind a callback to it and you
will get called with pgsql->state being KORE_PGSQL_STATE_NOTIFY.
2018-07-18 11:38:17 +02:00
Joris Vink 1447f6573f better http header validation. 2018-07-17 20:17:05 +02:00
Joris Vink 3312a2882f Let KORE_PREFIX override builtin prefix for kodev. 2018-07-17 15:59:59 +02:00
Joris Vink 05cccef77c toot toot 2018-07-17 15:16:27 +02:00
Joris Vink ac5a89fbeb pull in openssl/sha.h for body digest 2018-07-17 15:07:26 +02:00
Joris Vink c2289471b1 forcefully limit filemaps to GET | HEAD. 2018-07-17 15:05:20 +02:00
Joris Vink 616af063e3 Calculate an md over the incoming HTTP body.
This is calculated while the HTTP body is incoming over the wire, once
the body is fully received the digest will be available for the page
handlers to obtain.

You can obtain a hex string for this md via http_body_digest() or
dereferences the http_request and look at http_body_digest manually
for the bytes.
2018-07-17 14:53:55 +02:00
Joris Vink 9f2759e7b2 missing newline in error 2018-07-17 14:36:21 +02:00
Joris Vink 40a81a17ba remove kore_module_handle for NOHTTP=1 builds. 2018-07-17 14:28:43 +02:00
Joris Vink 0726a26c0c Allow restriction of methods for paths.
Now Kore will automatically send a 400 bad request in case the
method was not allowed on the path.
2018-07-17 14:23:57 +02:00
Joris Vink 993c5d2ac2 pledge keymgr process on openbsd 2018-07-14 21:14:02 +02:00
Joris Vink b957d26335 Let kore_worker_make_busy() not unlock solo workers 2018-07-13 21:04:59 +02:00
Joris Vink 02e7359970 Add kore_worker_make_busy().
Calling this from your page handler will cause your current worker
to give up the acceptlock (if it holds it).

This is particularly useful if you are about to run code that may block
a bit longer then you are comfortable with. Calling this will cause
the acceptlock to shuffle to another free worker which in turn makes
sure your application can keep accepting requests.
2018-07-11 18:00:16 +02:00
Joris Vink 52d14a3fbf Unbreak building with LibreSSL. 2018-07-11 12:50:50 +02:00
Joris Vink 2b3119d0e2 add overview of how the keymgr works 2018-07-11 11:53:56 +02:00
Joris Vink 6cf3b3c0dc Only use kore_root_path if its explicitly set.
Otherwise a relative path works well enough.
2018-07-11 11:08:44 +02:00