Commit Graph

892 Commits

Author SHA1 Message Date
Joris Vink
7b286f2f70 Set correct timeout start for websockets 2014-11-25 20:00:33 +01:00
Joris Vink
8fe16c193a Link with -lcrypto even for BENCHMARK 2014-11-24 11:31:50 +01:00
Joris Vink
ffe3fdc49d Add websocket mention 2014-11-24 11:11:01 +01:00
Joris Vink
1a680d8d09 Remove lingering diff file 2014-11-24 11:09:19 +01:00
Joris Vink
f867882f43 Add websocket support to Kore.
Introduces a few new api functions:

- kore_websocket_handshake(struct http_request *):
	Performs the handshake on an HTTP request (coming from page handler)

- kore_websocket_send(struct connection *, u_int8_t, void *, size_t):
	Sends data to a websocket connection.

- kore_websocket_broadcast(struct connection *, u_int8_t, void *, size_t, int):
	Broadcast the given websocket op and data to all connected
	websocket clients on the worker. Note that as of right now
	the WEBSOCKET_BROADCAST_GLOBAL scope option does not work
	yet and messages broadcasted will be restricted to workers
	only.

- kore_worker_websocket_broadcast(struct connection *, void *, void *):
	Backend function used by kore_websocket_broadcast().
	Could prove useful for developers to have access to.

A simple example is given under examples/websocket.

Known issues:
	Kore does not support PING or CONT frames just yet.
2014-11-24 11:08:34 +01:00
Joris Vink
ac4222e929 Proper use of kore_strtonum64(). 2014-11-24 10:39:38 +01:00
Joris Vink
a1e6588085 Repopulate now when we are doing idle timer checks.
Otherwise in a weird scenario the idle timer could
be started with a more recent time then the time we
test against causing a connection to disconnect
before its idle timer was over.
2014-11-21 16:38:23 +01:00
Joris Vink
9184257d97 Properly order linker arguments.
Fixes broken linkages with LDFLAGS on certain platforms see #23.
2014-11-19 14:20:31 +01:00
Joris Vink
280cd6791e bump README 2014-11-07 17:19:41 +01:00
Joris Vink
0f2a6271b9 Bump readme 2014-11-07 09:14:53 +01:00
Joris Vink
a4d50d3ddf Remove the my_callback example. Deprecated. 2014-10-31 10:14:47 +01:00
Joris Vink
b1797231cc Properly error out in HTML5 video streaming. 2014-10-31 10:13:45 +01:00
Joris Vink
27b4447a30 Allow workers to bind to specific CPUs on FreeBSD. 2014-10-26 22:41:55 +01:00
Joris Vink
9512805c04 spacing 2014-10-26 22:11:13 +01:00
Joris Vink
6de0f8568a Rework net, worker and some http internals.
- The net code no longer has a recv_queue, instead reuse same recv buffer.
- Introduce net_recv_reset() to reset the recv buffer when needed.
- Have the workers spread the load better between them by slightly
  delaying their next accept lock and giving them an accept treshold
  so they don't go ahead and keep accepting connections if they end
  up winning the race constantly between the workers.
- The kore_worker_acceptlock_release() is no longer available.

- Prepopulate the HTTP server response header that is added to each
  response in both normal HTTP and SPDY modes.
- The path and host members of http_request are now allocated on the heap.

These changes overall result better performance on a multicore machine,
especially the worker load changes shine through.
2014-10-22 21:16:49 +02:00
Joris Vink
0e8bdf38c4 Indenting police 2014-10-22 20:50:32 +02:00
Joris Vink
0d17d2228c Bring ktunnel example client in line with reality 2014-10-22 19:00:48 +02:00
Joris Vink
ffe94ff585 KORE_LDFLAGS is no more. 2014-10-22 18:48:43 +02:00
Joris Vink
b9445e84ca Use the right ssl_ctx 2014-10-22 18:44:31 +02:00
Joris Vink
217b2749f9 Merge pull request #22 from thorduri/master
Simplify environment variables, abide by POLA.
2014-10-22 18:32:36 +02:00
Thordur Bjornsson
e980dcdd5c Simplify environment variables, abide by POLA.
KORE_COMPILER => CC
KORE_LDFLAGS => LDFLAGS
2014-10-22 17:44:43 +02:00
Joris Vink
4f1336558c Merge pull request #21 from thorduri/master
Honor CC from the environment.
2014-10-22 17:13:04 +02:00
Thordur Bjornsson
c271ea6b3e Honor CC from the environment. 2014-10-22 17:02:25 +02:00
Joris Vink
81bc889abc Make ktunnel example tls1.2 only 2014-10-22 08:36:50 +02:00
Joris Vink
9bb7001813 Make sure we can still compile with BENCHMARK=1 2014-10-18 02:38:21 +02:00
Joris Vink
b49622bb1a Add CRL support.
Allow Kore to use per domain CRLs when requiring client certificates.
The require_client_cert configuration option has been renamed to a more
sane client_certificates and can optionally take a second argument
which is the CRL in pem format.

You'll need a restart in case the CRLs get updated.
2014-10-18 02:32:05 +02:00
Joris Vink
523bc521c7 Generate certs with sha256 digests from now on. 2014-10-18 01:28:47 +02:00
Joris Vink
79b3ccfe7d kqueue event list should hold worker_max_connections * 2 2014-10-16 21:45:43 +02:00
Joris Vink
693a07250f bump copyright years 2014-10-14 16:18:23 +02:00
Joris Vink
d142db2f45 Bump 2014-10-14 16:16:06 +02:00
Joris Vink
16f2d00d37 No more SSLv3 allowed. 2014-10-14 15:03:04 +02:00
Joris Vink
5855a88862 Increase frequency of idle_check. 2014-10-13 16:34:42 +02:00
Joris Vink
b668125ff7 Allow kore to build with openssl from osx brew. 2014-10-13 11:53:56 +02:00
Joris Vink
2b2e765fe6 Allow 0 parameters for kore_pgsql_query_params() 2014-10-12 01:17:35 +02:00
Joris Vink
a603b77e24 Add PUT/DELETE/HEAD methods (finally).
This commit renames certain POST centric variable and configuration
naming to the correct HTTP body stuff.

API changes include http_postbody_text() and http_postbody_bytes() to
have become http_body_text() and http_body_bytes().

The developer is still responsible for validating the method their
page handler is called with. Hopefully this becomes a configuration
option soon enough.
2014-10-08 11:03:14 +02:00
Joris Vink
3741e8ca3f Merge pull request #20 from jturner/openbsd-fix
Add required header for proper OpenBSD checking
2014-10-01 21:59:22 +02:00
James Turner
215a4d2da2 Add required header for proper OpenBSD checking 2014-10-01 13:08:38 -04:00
Joris Vink
626206f0d8 Set idle_timer.length in ktunnel to a high number.
This makes my tunnels not timeout every 20 seconds, much nicer.
2014-09-29 14:47:01 +02:00
Joris Vink
e1be630b84 Add kore_pgsql_getlength() which will return length of a column. 2014-09-28 23:03:49 +02:00
Joris Vink
3b09683f5c Add kore_pgsql_query_params().
This function uses PQsendQueryParams() instead of the normal PQsendQuery()
allowing you to pass binary data in a cleaner fashion.

A basic call would look something like:

char *mydata = "Hello";
size_t mydata_len = strlen(mydata);

kore_pgsql_query_params(&pgsql, req,
    "INSERT INTO foo VALUES($1::text)", KORE_PGSQL_FORMAT_TEXT, 1
    mydata, mydata_len, KORE_PGSQL_FORMAT_TEXT);

kore_pgsql_query_params() is variadic, allowing you to pass any
count of parameters where each parameter has the following:
	data pointer, data length, type of parameter.
2014-09-28 21:39:16 +02:00
Joris Vink
0909e6bac1 Write our assets.h with a fixed include guard. 2014-09-26 15:50:56 +02:00
Joris Vink
1c83af511d Make kore_mem_free() behave like free() and don't do anything if NULL is passed in. 2014-09-25 22:20:47 +02:00
Joris Vink
e3417dea16 Remove the pgsql simple layer again.
I rather keep the old idioms instead of adding more complex things
on top of the async ones. Especially since the simple layer would
interfear with existing http state machines from your handler.
2014-09-19 15:53:22 +02:00
Joris Vink
f73557c545 Use proper error message 2014-09-19 15:01:56 +02:00
Joris Vink
efec7bf8cf No need to set l here 2014-09-19 15:01:45 +02:00
Joris Vink
c0c3e9fb05 Use s instead of req->stream. 2014-09-19 15:01:25 +02:00
Joris Vink
eef40bf2dd add a .gitignore here 2014-09-19 14:51:14 +02:00
Joris Vink
c4c60e1960 Oops, make sure the new simple api can handle > 1 request without borking. 2014-09-19 14:49:12 +02:00
Joris Vink
f6f37437da In pgsql_simple_state_result() be sure to progress the sql state.
Drop back into waiting after our result so we can properly read out
the completed state.
2014-09-19 12:51:37 +02:00
Joris Vink
ee52746a7a indenting 2014-09-19 12:38:52 +02:00