Commit Graph

74 Commits

Author SHA1 Message Date
Joris Vink b4c54f9dc0 indent 2013-12-11 19:13:50 +01:00
Joris Vink 1e250c1473 Kore now supports GET parameters and automatic validation of GET/POST parameters.
Kore will automatically removes invalid parameters as a security measure.

See modules/examples/module.conf for an example of how this works.
2013-11-10 15:17:15 +01:00
Joris Vink 34c2f31a93 Add validators to kore, specified in the configuration using 'validator' keyword.
Example:
	validator	v_id	function	v_id_function
	validator	v_url	regex		^/url/path/[a-z]*$

You can then call these using kore_validator_run(char *, char *), example:

	if (!kore_validator_run("v_url", req->path))
		[req->path is bad];
2013-11-09 16:21:52 +01:00
Joris Vink 95c8b8e126 Add a callback that Kore can call in your module every given interval.
The callback is run from the parent process (which runs as root).

Adds kore_cb and kore_cb_interval configuration options.
2013-09-02 08:52:16 +02:00
Joris Vink 9c7aaf179f Remove unneeded malloc result casting, annoying habbit of mine but serves no purpose. 2013-07-13 21:08:55 +02:00
Joris Vink 95bacb5690 Kore will now keep track of page handlers that cause workers to die.
This is useful to track down any issues you might have in your module.

A log entry with a page handler causing issues looks like:
Jul  7 14:44:30 devbook kore[18191]: [parent]: worker 1 (18193)-> status 11
Jul  7 14:44:30 devbook kore[18191]: [parent]: worker 1 (pid: 18193) (hdlr: 0x242d9c0) gone
Jul  7 14:44:30 devbook kore[18191]: [parent]: hdlr serve_intro has caused 2 error(s)
2013-07-07 14:48:32 +02:00
Joris Vink c1723f2db5 Clean up header includes, based on a diff from Ewan Higgs via github.
And while we're messing in it, make sure bsd.c compiles again.
2013-07-06 20:55:22 +02:00
Joris Vink b4a0330a96 - Better spread load between all worker processes.
- Introduce own memory management system on top of malloc to keep track
  of all our allocations and free's. Later we should introduce a pooling
  mechanism for fixed size allocations (http_request comes to mind).
- Introduce ssl_cipher in configuration.

Memory usage is kind of high right now, but it seems its OpenSSL
doing it rather then Kore.
2013-06-27 08:43:07 +02:00
Joris Vink 6026a6d4ee add SNI support, and change domain configuration a bit. 2013-06-24 11:32:45 +02:00
Joris Vink a1b400c400 Add access logging to Kore. 2013-06-24 09:36:40 +02:00
Joris Vink 338047a95b use kore_log() to notify when a module is reloaded 2013-06-05 08:56:37 +02:00
Joris Vink e7db5ee6b1 rename kore_log to kore_debug, and allow one to turn it off. 2013-06-04 16:30:53 +02:00
Joris Vink cf6a6550f0 allow onload to be given in the config file.
onload specifies what function in your module to call when the module has been loaded or reloaded.
2013-05-30 21:26:39 +02:00
Joris Vink 61b937ac1b remove unused vars 2013-05-04 16:38:40 +02:00
Joris Vink 088d877715 switch dynamic handlers to regex based patterns, much easier. 2013-05-29 14:29:46 +02:00
Joris Vink 2290d09d3b Add dynamic handles, which can be used to partially match a URI and still call a cb handler. This is especially usefull when considering the handlers as a ruleset:
static /	serve_index
static /foo	serve_foo
dynamic /	serve_other

/ will be matched to serve_index, while /foo will be matched to serve_foo and /bar will be matched to serve_other for example.
2013-05-29 13:33:32 +02:00
Joris Vink 90588913d4 allow sending SIGHUP to kore, which will then reload its content module 2013-05-03 00:04:06 +02:00
Joris Vink f61bbe8ff4 move buf stuff back into kore.h, wont need it separately 2013-05-02 15:14:00 +02:00
Joris Vink 84428f7133 move buf stuff into its own header, so we can use it in spdy.h 2013-05-02 14:55:57 +02:00
Joris Vink 07f2f83def make sure we do not dereference p if its NULL 2013-05-02 13:47:53 +02:00
Joris Vink 807764614b from now on configuration files must specify a domain for the handlers that follow. This allows for easy subdomain configuration.
example:

domain joris.local
static / serve_index

domain .joris.local
static / serve_another_index
2013-05-02 13:30:13 +02:00
Joris Vink fa1a3099c1 better error msg 2013-05-01 17:16:09 +02:00
Joris Vink a39040ba9b build kore as -rdynamic so we can properly load modules.
implement kore_module_handler_find().
2013-05-01 16:11:10 +02:00
Joris Vink d9bbb0b1f1 initial module support 2013-05-01 16:03:48 +02:00