Commit Graph

148 Commits

Author SHA1 Message Date
Joris Vink ff613f4665 Use SSL_OP_CIPHER_SERVER_PREFERENCE by default. 2013-08-07 20:42:19 +02:00
Joris Vink bbfbfc4c61 add ssl_no_compression option to allow one to disable OpenSSL compression. 2013-08-07 16:59:45 +02:00
Joris Vink 04ee544982 Add support for ephemeral key exchange mechanisms, ssl_dhparam configuration option must be set (and point to a file containing a generated DH key). 2013-08-07 16:51:39 +02:00
Joris Vink db7ed69f2a Add kore_buf_replace_string().
kore_buf_replace_string allows you to replace occurances of a certain
string with something else.

Example:
	char	*username = "Joris";

	page = kore_buf_create(static_len_html_profile);
	kore_buf_append(page, static_html_profile, static_len_html_profile);
	kore_buf_replace_string(page, "%name%", username, strlen(username));
2013-08-07 14:56:14 +02:00
Joris Vink ef814a677d Add http_argument_multiple_lookup() and http_argument_multiple_free().
Prototypes:
	int	http_argument_multiple_lookup(struct http_req *req,
		    struct http_arg *args);
	void	http_argument_multiple_free(struct http_arg *args);

These functions can be used to lookup arguments in a single call.

args points to an array of struct http_arg elements. Each of them
have the argument name set and its value set to NULL.

The array must have its last element name field set to NULL.

Upon return http_argument_multiple_lookup() gives the caller the
number of arguments that were successfully found. It makes their values
available under the value field in the struct http_arg array passed.

Example:
	int			v;
	struct http_args	args[4];

	memset(args, 0, sizeof(args));
	args[0].name = "email";
	args[1].name = "password1";
	args[2].name = "password2";
	args[3].name = NULL;

	v = http_argument_multiple_lookup(req, args);
	if (v != 3) {
		kore_debug("argument %s was not present", args[v].name);
	} else {
		for (v = 0; args[v].name != NULL; v++)
			kore_debug("%s -> %s", args[v].name, args[v].value);
	}

	http_argument_multiple_free(args);
2013-08-07 14:41:16 +02:00
Joris Vink 6dbcb30eb9 properly calculate if we need to expand the header block in spdy_header_block_add(). 2013-08-06 15:58:21 +02:00
Joris Vink 3eb3665600 Detect right amount of cpu's available under osx. From Vaibhav Bhembre via github. 2013-07-28 19:21:49 +02:00
Joris Vink 659e19f92f add IPv6 support and support for multiple listeners. 2013-07-27 20:56:15 +02:00
Joris Vink 20f02ced23 remove meminuse and list of allocated memory blocks, we don't need it. 2013-07-25 23:41:00 +02:00
Joris Vink 712461b081 kore_buf_appendb(): free d once we are done with it. 2013-07-22 23:42:40 +02:00
Joris Vink 60ce2ce858 In kore_realloc() copy a minimum of old or new length bytes. 2013-07-22 22:44:42 +02:00
Joris Vink dca6e58189 remove commented out debug defines. 2013-07-18 22:13:59 +02:00
Joris Vink 91b839f355 Add OSX support, buildable via "make osx".
Make sure you have OpenSSL 1.0.0d+ (available from Macports) installed.

Based on diff from Vaibhav Bhembre via github
2013-07-17 20:19:44 +02:00
Joris Vink 2c1352b226 remove versioning numbers, i hate them. 2013-07-16 15:30:20 +02:00
Joris Vink 341172f844 Do not 0 out everything we allocate, and instead fix the behaviour of the code in the appropriate places. 2013-07-16 09:56:36 +02:00
Joris Vink ae9fabb84f No need to duplicate the received http buffer. 2013-07-16 09:33:46 +02:00
Joris Vink ced1279f88 Properly calculate worker offset, otherwise we'll eventually run into trouble. 2013-07-15 11:24:49 +02:00
Joris Vink 1f938eb818 Only release accept lock when required. 2013-07-15 11:12:05 +02:00
Joris Vink 29fa49ba83 Add fixed size memory pools and use them throughout Kore. 2013-07-15 11:06:36 +02:00
Joris Vink f54e7ace83 do not try to accept if accept has failed, but instead let kore continue 2013-07-13 22:24:00 +02:00
Joris Vink cebd1c2c2b Reduce footprint of meminfo and shuffle some stuff around 2013-07-13 22:19:50 +02:00
Joris Vink 51c8188f7a remove cast for malloc + add missing stdlib.h 2013-07-13 21:47:04 +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 94737a2a5f If the idletimer expires for SPDY sessions use spdy_session_teardown()
to remove it gently.
2013-07-13 20:29:29 +02:00
Joris Vink c999bf5001 Kore can now disconnect SPDY session if they've been idle too long.
Configurable via spdy_idle_time in your configuration file.

Setting this to 0 will keep SPDY sessions open indefinately.
2013-07-13 20:19:01 +02:00
Joris Vink f59e94a7b6 Add spdy_session_teardown() which can properly teardown a SPDY session.
Use this throughout the spdy code to propagate session errors (if any) occur.

At the same time fix BSD's missing CONN_WRITE_BLOCK
2013-07-13 19:56:38 +02:00
Joris Vink 0fee1247c9 TAILQ_REMOVE() the netbuf before adding it to the HEAD of recv_queue again. 2013-07-12 15:49:49 +02:00
Joris Vink 2e3720abc9 free() -> kore_mem_free() 2013-07-12 10:49:37 +02:00
Joris Vink 9eb32e668e use correct base64 alphabet (URL and Filename Safe Alphabet) 2013-07-10 15:04:01 +02:00
Joris Vink bb09e8b2a9 add base64 encoder/decoder in prep for http/2.0 and websockets 2013-07-10 15:00:53 +02:00
Joris Vink bb2d4903f2 remove NETBUF_RETAIN, no longer needed 2013-07-10 13:39:35 +02:00
Joris Vink 21a44589fc If we already have all the POST data in the netbuf do not try and read more. 2013-07-10 13:34:42 +02:00
Joris Vink 36d603ea67 When negotiating the protocol to be used using the NPN extension keep in mind that http/1.1 can be given there as well. (Googlebot does this, and thus couldn't access Kore sites).
On top of that be extra careful with how many bytes we memcmp() if we receive data from the NPN extension.

This fix makes googlebot and anybody negotiating http/1.1 over NPN properly.
2013-07-10 10:37:37 +02:00
Joris Vink 94eee6a8d1 - Do not wrongly ignore WINDOW_UPDATE frames when a stream is still active.
- Only unblock a stream if it was actually blocked before.
2013-07-09 15:21:48 +02:00
Joris Vink b0c67df902 fix a typo 2013-07-09 13:27:39 +02:00
Joris Vink 649e81afd7 use handler function name if available when logging a worker process that has died. 2013-07-07 14:56:50 +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 7df5339c8d Properly fix bsd.c, sigh. 2013-07-06 21:05:17 +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 886c3920db sysconf() returns -1 on failure, cpu_count is an unsigned integer, failure would never have been caught.
from cremno via github
2013-07-05 22:17:56 +02:00
Joris Vink 87d8fd784b do not attempt to log the user-agent if it's not available. 2013-07-05 22:03:05 +02:00
Joris Vink 51efd84b6e also set has_lock to 0 when a worker starts. 2013-07-05 21:17:08 +02:00
Joris Vink e1183e22a6 If the worker that owns the accept lock dies, make sure the next one in line can grab it. Otherwise kore comes to a halt (by not accepting new connections). 2013-07-05 20:19:50 +02:00
Joris Vink eb43fd31e1 remove unused stuff 2013-07-05 16:02:03 +02:00
Joris Vink 69df62f0ea when receiving SETTINGS verify that the number of settings received by
the client matches the length of the SPDY frame we received.
Otherwise bad clients could potentially cause us to misbehave.
2013-07-01 12:34:18 +02:00
Joris Vink 0c08b57d3e - add idle timer for normal connections (ie: !SPDY), max 20 seconds.
- use idle timer to make sure we don't block SPDY connections indefinately
  when our window size has reached 0.
2013-07-01 12:08:51 +02:00
Joris Vink 51a9e4db9d Implement SPDY WINDOW_UPDATE and SETTINGS. 2013-07-01 11:30:18 +02:00
Joris Vink 6fa881e224 SSL_set_accept_state() when a new SSL * is created 2013-06-27 12:37:42 +02:00
Joris Vink 108a0cbc81 remove unneeded blocks of code 2013-06-27 12:37:27 +02:00
Joris Vink 3c6169a861 bring bsd into sync 2013-06-27 12:37:14 +02:00