Joris Vink
57840a8366
Deal with the Host header in a way IPv6 hosts work
...
Fixes #164 .
2017-01-11 11:01:58 +01:00
Joris Vink
10929189a0
make sure we can call pgsql_conn_cleanup() properly.
2017-01-10 15:29:03 +01:00
Joris Vink
f5ad76a2c3
better description.
2016-12-29 20:15:01 +01:00
Joris Vink
fe7237fd74
Take over linker from env if present.
2016-12-29 20:14:16 +01:00
Joris Vink
6faed21a24
Revert "Invoke platform alternatives #158 ( #160 )"
...
This reverts commit 857a3cfb79
.
2016-12-29 20:12:46 +01:00
Yvan Sraka
857a3cfb79
Invoke platform alternatives #158 ( #160 )
2016-12-28 09:29:13 +01:00
Joris Vink
c16461c6c1
adjust format after changing it earlier.
2016-12-27 09:45:27 +01:00
Joris Vink
be5d1f310f
initialize mime_types when swapping flavors as well.
2016-12-27 09:39:06 +01:00
Joris Vink
8b528e0334
Add asset_sha1_* and asset_serve_* to assets.h.
2016-12-27 09:22:13 +01:00
Joris Vink
4f9044c6e0
fix count in kore_pgsql_query_params().
...
should fix #159 .
2016-12-27 09:10:31 +01:00
Joris Vink
31d14d028a
add compile-time configurable mime types.
...
these types are used for the new builtin asset_serve_* functions.
must be defined in conf/build.conf.
2016-12-26 23:37:05 +01:00
Joris Vink
d783a1d22d
Add auto generated serving functions for assets.
...
These functions are created by the cli tool when building
and follow the naming format: asset_serve_<name>_<ext>().
Those serving functions can be used directly in handlers and
callthrough to a http_serveable() function that uses the SHA1
of the asset as its ETag and automatically checks for if-none-match.
2016-12-26 21:15:03 +01:00
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
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
Raphaël Monrouzeau
06d9ca96da
JSONRPC Updated to last kore_buf* commit
2016-07-15 13:17:30 +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
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
Joris Vink
d30921103b
Code cleanup, several API breaking changes in here
2016-07-08 10:03:41 +02:00