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
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
ba84a1a5e2
add osx and some flavor
2013-07-17 20:28:40 +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
19a05b0768
Remove stuff that was done
2013-07-16 09:49:26 +02:00
Joris Vink
ea0d314bd9
Bring down allowed http header size to 4K, perhaps should be tweakable?
2013-07-16 09:45:45 +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
777cfda791
More stuff todo, woop.
2013-07-13 19:02:16 +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