Commit Graph

960 Commits

Author SHA1 Message Date
Joris Vink facc8b9d6c set req->owner to NULL when the connection removes it. 2016-12-26 20:08:53 +01:00
Joris Vink 543a329ef6 run the connection timeout test per event loop. 2016-12-26 20:03:01 +01:00
Joris Vink 194b575ebf Add SHA1 digests for assets. 2016-12-22 19:44:35 +01:00
Joris Vink 583d75edcb remove unneeded parenthesis. 2016-12-05 14:45:29 +01:00
Joris Vink ae28f51d56 ERR_clear_error() in front of SSL_accept as well. 2016-12-05 14:44:58 +01:00
Joris Vink cb13190e0d Call ERR_clear_error() before SSL_read() and SSL_write() calls. 2016-12-05 14:24:22 +01:00
Joris Vink 16166d37bd remove debug macro 2016-12-04 16:52:11 +01:00
Joris Vink 652833a979 set worker_active_connections to 0 always.
fixes a bug where if a worker died it contained garbled data...
2016-12-04 16:49:42 +01:00
Joris Vink cb62a6a8a8 Clamp netwait to maximum 100ms. 2016-12-04 12:16:27 +01:00
Tobias Kortkamp 950977f2be Fix fd leak in cli_buildopt_parse() (#156)
The build.conf file is left open when using kore run.
2016-12-01 09:01:51 +01:00
Tobias Kortkamp 7eced6f035 Fix #153 (#155)
Compiling with Clang 3.9 on FreeBSD raises the following error (see [1]):
```
src/pgsql.c:222:17: error: passing an object that undergoes default argument promotion to 'va_start'
      has undefined behavior [-Werror,-Wvarargs]
        va_start(args, count);
                       ^
src/pgsql.c:217:45: note: parameter of type 'u_int8_t' (aka 'unsigned char') is declared here
    const char *query, int result, u_int8_t count, ...)
```
More information about this warning can be found on [2].

To solve this we can change the type of `count` to `int` in
`kore_pgsql_query_params()` and `kore_pgsql_v_query_params()`. This
also matches the signatures of both `PQexecParams()` [3] and
`PQsendQueryParams()` [4].

[1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214639
[2] https://www.securecoding.cert.org/confluence/display/cplusplus/EXP58-CPP.+Pass+an+object+of+the+correct+type+to+va_start
[3] https://www.postgresql.org/docs/9.2/static/libpq-exec.html
[4] https://www.postgresql.org/docs/9.2/static/libpq-async.html
2016-11-19 12:56:51 +01:00
Joris Vink 5b379a9185 add a kore_preload() call for single binaries.
This is run on the parent before workers are spawned.
2016-11-17 10:05:16 +01:00
Joris Vink 5abb56d6fb remove unused define. 2016-11-04 09:21:09 +01:00
Joris Vink 5e1cb53f13 use a copy of args when falling back to vasprintf. 2016-11-04 09:16:05 +01:00
Joris Vink 552d59248c constify delim in kore_split_string(). 2016-10-06 16:50:41 +02:00
Joris Vink 4a72877f4e count active connections properly 2016-10-06 16:50:02 +02:00
Tobias Kortkamp c071d64bdd Fix #144. Always initialize va_list in kore_pgsql_query_params. (#146) 2016-09-05 16:22:46 +02:00
john721 f15558ed98 Fix no response in case kore was built with NOTLS=1. (#142) 2016-08-16 10:19:07 +02:00
Joris Vink 7d1d5329c9 Link to latest release. 2016-08-01 15:12:30 +02:00
Joris Vink 176bd204b2 Update README 2016-08-01 15:03:22 +02:00
Joris Vink 8b723479ec bump 2016-08-01 15:01:19 +02:00
Joris Vink a16348d524 Remove links to kore.io for releases 2016-08-01 09:59:32 +02:00
Joris Vink c2dd274c40 update with latest 2016-08-01 09:41:12 +02:00
Joris Vink 441cc34f31 bump to release 2016-08-01 09:38:40 +02:00
Joris Vink 77adb35193 JSONRPC requires HTTP, let users figure that out the hard way. 2016-08-01 09:25:56 +02:00
Joris Vink db4f6cf01f align pointers from kore_malloc() properly. 2016-07-28 14:52:15 +02:00
Joris Vink 0b92afe53d Explicitly set offset to 0 for http_file. 2016-07-27 16:43:05 +02:00
Joris Vink 46cee2ff46 Typo. 2016-07-15 22:34:21 +02:00
Joris Vink f5923af1c6 Add /usr/local/[include|lib] for BSD / JSONRPC. 2016-07-15 22:33:58 +02:00
Joris Vink 6ba8dd439b Merge pull request #135 from raphaelmonrouzeau/master
Add conditional JSON-RPC support
2016-07-15 22:25:52 +02:00
Raphaël Monrouzeau 06d9ca96da JSONRPC Updated to last kore_buf* commit 2016-07-15 13:17:30 +02:00
Raphaël Monrouzeau cd9ce057ea JSONRPC Changed Makefile option location 2016-07-15 13:08:08 +02:00
Raphaël Monrouzeau 32ac27d4c3 JSONRPC Reverted explicit deallocation calls
The possibility to call jsonrpc_destroy_request was left. Someone may
want to abruptly interrupt the process of its request for some odd
reason, in that case an exlicit call still would be to be made.
2016-07-15 13:08:08 +02:00
Raphaël Monrouzeau 7a4e4223c4 JSONRPC If support compiled in log it at start 2016-07-15 13:08:08 +02:00
Raphaël Monrouzeau a818555c96 JSONRPC use size_t to get in line with last commit
Kore now uses size_t for kore_buf and http_response() so response size
check is useless and u_int32_t variables should be converted.
2016-07-15 13:08:08 +02:00
Raphaël Monrouzeau 016dc27346 JSONRPC Made request destruction explicit
Caller has now to destroy jsonrpc_request after use. This permits them
to read / inspect it after having responded.
2016-07-15 13:08:08 +02:00
Raphaël Monrouzeau 8c78b28be3 JSONRPC Removed upload size limit check
A true application dependant limit check would require stream parsing.
As the limit enforcement was done, it added nothing of value compared
to HTTP request limit check, which is in Kore already.
2016-07-15 13:08:08 +02:00
Raphaël Monrouzeau 3366ec6573 Required params to be structured as per spec 2016-07-15 13:08:08 +02:00
Raphaël Monrouzeau 4ffe43cf87 Compliantly don't return anything to notifications
And don't return anything either if protocol doesn't match.
2016-07-15 13:08:08 +02:00
Raphaël Monrouzeau db02e990ea JSON-RPC support for Kore.
The API surface is very limited. Jsonrpc support reads request from HTTP
body and such can't be activated if NOHTTP=1. At the moment there is no
websocket support either (which is a shame). It depends upon the
third-party Yajl library.

Errors can be emitted using jsonrpc_error() and results using
jsonrpc_result(), for the later you'll have to provide a callback which
will write the inner of the result object.

If errors happen during the response write process, no further error
output will be attempted and an HTTP error 500 will be returned.

Read the provided example for getting a better idea of the API.
2016-07-15 13:08:08 +02:00
Joris Vink 2cf83aea3c Merge branch 'raphaelmonrouzeau-kore_buf_noalloc' 2016-07-14 12:42:40 +02:00
Joris Vink 00b64033ca More buf improvements.
- make sure kore_buf_alloc() and kore_buf_init() buffers behave
  the same way in regards to calling kore_buf_release() and what not.
2016-07-14 12:41:39 +02:00
Joris Vink 43fec8678e kore_buf_create -> kore_buf_alloc. 2016-07-14 12:34:29 +02:00
Joris Vink b28b60c2ff buf API changes.
- rename kore_buf_destroy() to kore_buf_cleanup().
- rename kore_buf_create() to kore_buf_alloc().
2016-07-14 12:33:13 +02:00
Joris Vink 3b0477cf97 kore_mem_free -> kore_free 2016-07-14 12:29:49 +02:00
Joris Vink 7cf73b5fa5 Merge branch 'kore_buf_noalloc' of https://github.com/raphaelmonrouzeau/kore into raphaelmonrouzeau-kore_buf_noalloc 2016-07-14 12:28:51 +02:00
Joris Vink 33c0b3c753 Make pools thread-safe if built with TASKS.
Use CAS to implement primitive spinlock ontop of the pool
if we have been built with TASKS=1.

This allows tasks to safely use kore_malloc() and kore_free()
since those are now backed by pools.
2016-07-12 16:30:57 +02:00
Joris Vink 3c43d1203c Move towards size_t in the pool API. 2016-07-12 14:01:02 +02:00
Joris Vink 4ad50caa29 Large changes to the memory subsystem in kore.
- Change pools to use mmap() for allocating regions.
- Change kore_malloc() to use pools for commonly sized objects.
  (split into multiple of 2 buckets, starting at 8 bytes up to 8192).
- Rename kore_mem_free() to kore_free().

The preallocated pools will hold up to 128K of elements per block size.

In case a larger object is to be allocated kore_malloc() will use
malloc() instead.
2016-07-12 13:54:14 +02:00
Raphaël Monrouzeau db3cf28d22 Added kore_buf no alloc functions.
kore_buf_create and kore_buf_free do use kore_malloc. But sometimes you
may embed a kore_buf inside a structure and would like a single way to
initialize / destroy it.
2016-07-09 12:30:24 +02:00