Commit Graph

694 Commits

Author SHA1 Message Date
Joris Vink
3ee07cfbfe Add SSE (Server Side Events) example. 2015-05-15 19:23:26 +02:00
Joris Vink
875b3a46e6 SPDY stream changes.
Allow callers to set an onclose callback method for SPDY streams
so they can get notified when a stream is closed.

Also add SPDY_NO_CLOSE which tells the underlying Kore layer
to not send a FIN for a SPDY stream until a module does it itself.
2015-05-15 19:17:09 +02:00
Joris Vink
1dd7407a41 Close SPDY streams if len == 0 and SPDY_NO_CLOSE is not set. 2015-05-15 19:16:35 +02:00
Joris Vink
cefeaf7992 HTTP layer improvements.
Add HTTP_REQUEST_NO_CONTENT_LENGTH which can be set by
a handler before calling http_response() to avoid Kore
from setting the content-length altogether.

If we are on a SPDY connection do not close the stream
if we do not pass data to http_response().
2015-05-15 19:12:18 +02:00
Joris Vink
0c4dbad2fb Kore timer improvements.
Introduces kore_timer_remove() and updates kore_timer_add()
to return the newly added timer as a struct kore_timer.

Also allow arguments to be passed to timers.
2015-05-15 19:11:10 +02:00
Joris Vink
e2ce032b02 Do not treat EPOLLRDHUP as a connection error. 2015-05-15 19:10:23 +02:00
Joris Vink
a45a57f36a Merge pull request #51 from thorduri/build-badge
travis build badge
2015-05-13 10:11:26 +02:00
Thordur Bjornsson
f2b4efbdc5 travis build badge 2015-05-13 10:02:31 +02:00
Joris Vink
b648c108c2 Merge pull request #50 from thorduri/janitor
fix copy pasto.
2015-05-13 09:58:10 +02:00
Joris Vink
e25801f461 Merge pull request #49 from thorduri/travis
travis
2015-05-13 09:48:55 +02:00
Thordur Bjornsson
ce20f37166 travis 2015-05-13 09:40:52 +02:00
Joris Vink
09ed61187b Unfuck content-length changes.
We want a content-length unless its 204 or status < 200.
2015-05-13 09:16:06 +02:00
Joris Vink
7ce742f131 Merge pull request #48 from thorduri/content-length
Always write out content-length;
2015-05-13 09:02:58 +02:00
Thordur Bjornsson
a62bce3e88 Always write out content-length;
Unless status is 204 or 1xx (informational).
2015-05-12 20:23:47 +02:00
Thordur Bjornsson
52e67ff4a1 fix copy pasto. 2015-05-12 13:28:18 +02:00
Joris Vink
d3e3788162 Merge pull request #47 from thorduri/misc-cli
miscellaneous mask fixes
2015-05-12 08:47:17 +02:00
Thordur I. Bjornsson
dcb0f458e7 set a wee bit saner umask 2015-05-09 12:14:49 +00:00
Joris Vink
4f36b534aa Reset fsm_state back to 0 after we're done with it. 2015-05-08 21:19:20 +02:00
Thordur I. Bjornsson
bb6e2823a0 fix tyop 2015-05-08 14:53:59 +00:00
Thordur I. Bjornsson
9f823f345e no need to open cert/key files for read 2015-05-08 14:41:48 +00:00
Thordur I. Bjornsson
9418139c76 no need for execute bit in cli_file_open 2015-05-08 14:40:51 +00:00
Joris Vink
603e353eab Merge pull request #46 from thorduri/config
Continue on terminating '}' in a config stanza.
2015-05-07 20:34:25 +02:00
Joris Vink
cd35c10224 Make clang a little bit happier. 2015-05-07 20:32:21 +02:00
Thordur I. Bjornsson
1e8e5bad7f Continue on terminating '}' in a config stanza. 2015-05-07 14:26:01 +00:00
Joris Vink
b0947b73d9 Let modules decide if they want to be reloaded.
At times it seems relevant that worker their modules should not
be reloaded when receiving a SIGHUP. Developers can now control
this by returning anything else but KORE_RESULT_OK from their
initialization methods.

The parent module will always be reloaded.
2015-05-07 13:03:10 +02:00
Joris Vink
384bc8fdd6 Default to only TLSv1.2 from now on.
Add configuration setting tls_version to specify if you
either want TLSv1.2 or TLSv1.0 or both.

The configuration options ssl_cipher and ssl_dhparam
have changed name to tls_cipher and tls_dhparam. There is
no fallback so you might have to update your configs.
2015-05-06 10:59:43 +02:00
Joris Vink
48495feb43 No, I was wrong. The dh params were created in the right place. 2015-05-06 10:21:54 +02:00
Joris Vink
5b462f3ab6 Always attempt to create dh2048.pem if not present 2015-05-06 10:18:54 +02:00
Joris Vink
25578d9428 Pass the proper size to http_state_run(). 2015-05-06 10:18:25 +02:00
Joris Vink
97bd389935 Use IPC_PRIVATE when creating our shm.
Instead of a homegrown mechanism of finding empty SHM
keys that may or may not be available.

Should fix #44
2015-04-28 10:21:15 +02:00
Joris Vink
e5f6d37cd2 Make parameter validation less noisy. 2015-04-27 15:35:02 +02:00
Joris Vink
99922d9468 I'm such a slacker. Forgot to mention 1.2.2 2015-04-27 10:51:37 +02:00
Joris Vink
09ad47ae48 Add worker_set_affinity to example configuration. 2015-04-27 10:37:58 +02:00
Joris Vink
b0deac577c Add new configuration option: worker_set_affinity.
Controls wether or not worker processes sets its affinity
mask to bind themselves to a single CPU.

Defaults to on (1).
2015-04-27 10:36:33 +02:00
Joris Vink
b035dea3ff Make socket error messages more understandable. 2015-04-26 21:09:46 +02:00
Joris Vink
cdc2648d40 Move towards 1.2.3-rc1 2015-04-24 15:54:21 +02:00
Joris Vink
ee22ec99d6 Task improvements.
Do not blindly close the sockets created by socketpair() when
finishing up or destroying a task.

Under heavy load this could turn into a race condition where
the task thread closes its endpoint when at the same time
a new task is registered and socketpair() returns the recently
closed socket back to a new task.

When the task that finished then gets destroyed it closes
the endpoint registered to a new task instead causing Kore
to fatal() out when attempting to read from said socket.
2015-04-24 14:20:02 +02:00
Joris Vink
6be54040f3 Use kevent() to schedule an event immediately.
Instead of merging it in under the kevent() call under
the event loop. Strange side effects are showing on OSX
under heavy load.
2015-04-24 11:45:00 +02:00
Joris Vink
58864005e0 Do not leak key in kore_websocket_handshake on error. 2015-04-24 09:22:32 +02:00
Joris Vink
b869041a14 Introduce new config option worker_accept_treshold
This configuration option limits the maximum number
of connections a worker process can accept() in a single
event loop.

It can be used to more evenly spread out incoming connections
across workers when new connections arrive in a burst.
2015-04-23 10:24:00 +02:00
Joris Vink
dc6e6fb1b4 Kill NETBUF_CALL_CB_ALWAYS for incoming HTTP body
Do not let the NETBUF_CALL_CB_ALWAYS flag linger in
the netbuf we reset for the incoming HTTP body.
2015-04-21 11:30:59 +02:00
Joris Vink
4c39ac43fb Properly deal with accept() failing.
In cases where accept() failed Kore would not relinquish the
lock towards other worker processes.

This becomes evident when dealing with a high number of concurrent
connections to the point the fd table gets full. In this scenario
the worker with the full fd table will spin on attempt to accept
newer connections.

As a bonus, Kore now has allows exactly up to worker_max_connections
of connections per worker before no longer attempting to grab the
accept lock.
2015-04-20 15:17:42 +02:00
Joris Vink
dfea3cf483 Place path and host in http_request into pools.
Also change the amount of times we end of doing unneccessairy strlen() calls.
2015-04-15 12:40:15 +02:00
Joris Vink
6c2e4dd831 Task improvements.
* Always start listening on the task its socket endpoint when
  called kore_task_run() instead of at kore_task_bind_request().

* Disable read events on the task its socket endpoint when
  kore_task_handle() is called for a finished task. Stops us
  from entering a busy loop until kore_task_destroy() is called.
2015-04-14 09:01:36 +02:00
Joris Vink
097a1166df Improve very heavy load handling.
Introduces two new configuration knobs:
	* socket_backlog (backlog for listen(2))
	* http_request_limit

The second one is the most interesting one.

Before, kore would iterate over all received HTTP requests
in its queue before returning out of http_process().

Under heavy load this queue can cause Kore to spend a considerable
amount of time iterating over said queue. With the http_request_limit,
kore will process at MOST http_request_limit requests before returning
back to the event loop.

This means responses to processed requests are sent out much quicker
and allows kore to handle any other incoming requests more gracefully.
2015-04-09 15:29:44 +02:00
Joris Vink
057924a5d5 Move to 1.2.2-develop 2015-04-09 11:45:17 +02:00
Joris Vink
b0ff041709 call setrlimit() before we drop privs. 2015-04-09 10:06:18 +02:00
Joris Vink
5f1238c2dc Merge pull request #40 from Geenz/master
Support PUT, DELETE, and HEAD methods in configs.
2015-04-09 10:00:42 +02:00
Joris Vink
dc4f856c5c Use UINT_MAX for limit of worker_max_connections. 2015-04-09 08:56:12 +02:00
Geenz
2b907545ca Support PUT, DELETE, and HEAD methods in cofigs.
The primary usecase for this is RESTful APIs where PUT, DELETE, and HEAD can be useful methods to support.
2015-04-08 19:46:27 -04:00