1994 Commits

Author SHA1 Message Date
Joris Vink
c30ff58b93 control characters have nothing to do inside a URL. 2013-10-18 12:43:20 +02:00
Joris Vink
5d027b7a21 Decode all url encoded components properly. 2013-10-18 12:32:00 +02:00
Joris Vink
ca05fb74d1 Properly calculate GMT time in kore_date_to_time() 2013-10-15 15:06:19 +02:00
Joris Vink
6028a3edc3 Get rid of some bash-ism and do stuff ourselves. 2013-10-15 14:54:02 +02:00
Joris Vink
190315c238 Make inject.c no longer spew warnings, instead use correct widths for time_t on all platforms. 2013-10-15 13:33:35 +02:00
Joris Vink
49df7a313b Make sure d cannot be used uninitialized. 2013-10-15 13:10:30 +02:00
Joris Vink
ee99503323 Fix building example module in OpenBSD. 2013-10-15 13:09:00 +02:00
Joris Vink
c64d3e7854 Add http_keepalive_time configuration parameter.
Allows you to configure maximum amount of seconds an HTTP connection
can stay open (does not affect SPDY connections). If set to 0 it will
disable keep-alive all together.

Add some inttypes fluff.
2013-10-15 11:10:45 +02:00
Joris Vink
07079dc8c0 Do not kill a connection if nb->len is 0 when sending data. 2013-10-15 11:09:33 +02:00
Joris Vink
8b47863cd4 Add http_hsts_enable (enabled by default with max-age=31536000) to Kore's configuration file.
If enabled Kore adds the HSTS header to every response.

- Additionally, fix some typos in the example configuration.
- Change default SSL cipher list again, no more RC4 and almost PFS for all browsers.
2013-10-15 10:44:56 +02:00
Joris Vink
b75ac15e50 add scaling documentation 2013-10-14 15:03:58 +02:00
Joris Vink
9426906225 Long overdue, let Kore pick its own shm key if the default KORE_SHM_KEY is already taken. 2013-10-14 11:26:11 +02:00
Joris Vink
d2447a8848 Better defaults for ssl_cipher, was already in example config but not here. 2013-10-14 09:26:48 +02:00
Joris Vink
1fb3c013ff Use kore_mem_find() in kore_buf_replace_string(), fixes certain crashes
that could occur when calling kore_buf_replace_string() with patterns
that would be found at the end or start of the buffer.
2013-09-26 16:49:44 +02:00
Joris Vink
3359be363f add limits.h so we can compile in 32-bit systems. 2013-09-24 09:15:31 +02:00
Joris Vink
0d63fd829b change some comments 2013-09-24 08:59:37 +02:00
Joris Vink
0a49f29e10 Add support for ECDH and provide a better ssl_cipher set by default. 2013-09-24 08:58:05 +02:00
Joris Vink
dde4f9f75a Be more verbose when configuration errors pop up. 2013-09-22 20:11:56 +02:00
Joris Vink
88c3a3eb98 Add http_header_max and http_postbody_max configuration variables.
- http_header_max:
	Maximum size of HTTP headers (in non SPDY connections).

- http_postbody_max:
	Maximum size of an HTTP POST body (both in SPDY and HTTP mode).

Right now Kore will simply DC the client, ideally we want to send
a 413 (entity too large) to the client however.

See modules/examples/module.conf for more.
2013-09-22 20:05:24 +02:00
Joris Vink
ef463b49eb Merge remote-tracking branch 'origin/master' 2013-09-10 14:05:31 +02:00
Joris Vink
cffe4afb91 properly count amount of arguments parsed 2013-09-10 14:05:02 +02:00
Joris Vink
9650a7654a remove test settings 2013-09-10 11:17:40 +02:00
Joris Vink
25e8f93331 Add support for multipart forms.
New API functions (docs need to be updated):
	- http_file_lookup()
	- http_file_add()
	- http_argument_add()
	- kore_strip_chars()
	- kore_mem_find()

- Add an example under the example module on how files can be read.
2013-09-10 11:02:59 +02:00
Joris Vink
8566c32da8 Properly send WINDOW_UPDATE messages to the client when our window is full.
Fixes uploads > 64kb when using SPDY
2013-09-09 11:24:15 +02:00
Joris Vink
c9d4f70298 - Add SPDY RST control frame handler.
- Keep HTTP requests in connection, so we can delete them if the connection
  ends before the requests do (this way we don't leak them).
- When spdy_stream_close() is called, delete the attached http request.
  (This shouldn't hurt to do, so hopefully won't cause major fallout).
- When parsing HTTP, find the first occurence of end-of-headers so uploads
  with multipart/form-data can succeed properly.
- Add a test upload page to the example module.
2013-09-09 10:59:56 +02:00
Joris Vink
ee3fd3c039 Allow the user defined callback to run on workers as well. 2013-09-03 08:41:09 +02:00
Joris Vink
95c8b8e126 Add a callback that Kore can call in your module every given interval.
The callback is run from the parent process (which runs as root).

Adds kore_cb and kore_cb_interval configuration options.
2013-09-02 08:52:16 +02:00
Joris Vink
9fa9fd7402 remove useless casts 2013-08-26 08:52:56 +02:00
Joris Vink
acc34e2d51 Change kore_buf_append() and kore_buf_replace_string() to take a void pointer. 2013-08-22 10:06:39 +02:00
Joris Vink
a8052c7ac4 Add reason phrases and http status constants (HTTP_STATUS_* see includes/http.h)
Based on work from mendor/ymv via github.
2013-08-19 09:11:31 +02:00
Joris Vink
ef9d37e54b free hdlr_extra if its set 2013-08-14 16:09:09 +02:00
Joris Vink
ecefdb18ab cb_extra -> hdlr_extra and add one to struct connection as well for persistent data across requests. 2013-08-14 15:56:44 +02:00
Joris Vink
34f6d088fa set cb_extra to NULL when req is allocated 2013-08-14 15:15:18 +02:00
Joris Vink
8d2327570c add cb_extra to http_requests so its a bit easier to pass certain data between handler functions (kore won't touch cb_extra). 2013-08-14 15:13:09 +02:00
Joris Vink
bbb245654d Pass the base for strtoll() to kore_strtonum(), breakage ensues if we depend on the "auto" detection that happens when we pass 0 to strtoll() as base. 2013-08-13 16:13:43 +02:00
Joris Vink
af5f416e6d and as always, remove debug. 2013-08-13 14:19:57 +02:00
Joris Vink
3075162855 Add http_argument_urldecode() which takes a string and decodes any url encoding done to it.
Change kore_strtonum() to pass 0 to strtoll by default so we can use it to convert hex numbers (prepended with 0x) as well.
2013-08-13 14:18:47 +02:00
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
429768ba37 Add ssl_dhparam 2013-08-07 16:55:13 +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
bb9f37f029 remove KORE_DEBUG define that sneaked in 2013-08-07 14:59:59 +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
89f12a61e5 Add osx to makefile options.
From Vaibhav Bhembre via github
2013-07-28 20:02:01 +02:00
Joris Vink
d40bd805f5 s/support/supported 2013-07-28 19:25:46 +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