475 Commits

Author SHA1 Message Date
Joris Vink
76383f2353 Close fp after reading configuration 2014-04-09 14:43:23 +02:00
Joris Vink
250a1e1ad1 Fix use after free 2014-04-09 14:35:14 +02:00
Joris Vink
630d8ece05 Fuck it, force OpenSSL to not use its freelists no matter what. 2014-04-09 14:14:09 +02:00
Joris Vink
41aed45e4f Do not miscalculate end_headers. 2014-04-09 09:21:22 +02:00
Joris Vink
8e93dbc396 amend example with additional query + kore_pgsql_logerror() 2014-04-02 23:01:47 +02:00
Joris Vink
71b69f108e Fixup the actual example 2014-04-01 21:44:32 +02:00
Joris Vink
39a9f7d6f0 Add new wrappers 2014-04-01 21:44:22 +02:00
Joris Vink
9e3d19fbbd pgsql fixes + new wrappers 2014-04-01 21:43:52 +02:00
Joris Vink
b19897b578 add cert/ 2014-04-02 00:07:52 +02:00
Joris Vink
6195bf646c Change path to reflect new contrib folder 2014-04-02 00:06:35 +02:00
Joris Vink
89b603c247 Support postgresl under the bsds 2014-04-02 00:06:24 +02:00
Joris Vink
211f82847e Add example pgsql module showing how one can use the KORE_PGSQL stuff 2014-03-31 11:30:21 +02:00
Joris Vink
22882261f7 Properly use pg_config --includedirs + move modules to contrib 2014-03-31 11:29:51 +02:00
Joris Vink
f7190c8b12 Remove pgsql example from here, reset module.conf back to roots 2014-03-31 11:28:06 +02:00
Joris Vink
a431f76263 pgsql_conn improvements.
set conn inside kore_pgsql to NULL when we've completed.
if at kore_pgsql_cleanup() time the conn is still there
we'll drain it as per documentation.
2014-03-31 01:09:08 +02:00
Joris Vink
6eb091c77c Layout that stuff like a 80 column terminal nerd.
And mark a request as DONE when we get PGRES_COMMAND_OK.
2014-03-31 01:04:22 +02:00
Joris Vink
61b6f823c5 Improvements to pgsql contrib code.
Including but not limited to:
- Correctly use PQerrorMessage() in case we cleanup with PQfinish
- If we get a network error, cleanup the connection
- No longer call the page handler from inside kore_pgsql_handle()
  but instead just put it to sleep in case we don't need it.
  This does grow the http_requests list quite a bit with sleeping
  connections and can perhaps be improved later on.
- Allow us to on error return OK from a page handler from inside
  the completetion block for KORE_PGSQL().
- Count the cummulative time for a request to finish instead
  of the latest run time for the handler.
2014-03-31 00:57:00 +02:00
Joris Vink
2f044cc7eb Initial stab at entering postgresql contrib code.
Has support for full async pgsql queries. Most of the logic
is hidden behind a KORE_PGSQL() macro allowing you to insert
these pgsql calls in your page handlers without blocking the
kore worker while the query is going off.

There is place for improvement here, and perhaps KORE_PGSQL won't
stay as I feel this might overcomplicate things instead of making
them simpler as I thought it would.
2014-03-30 23:54:35 +02:00
Joris Vink
8003bad094 Missing sys/stat.h, from James Turner 2014-03-07 09:55:28 +01:00
Joris Vink
d40fd489f8 s/ptr/entry 2014-03-06 08:21:58 +01:00
Joris Vink
69f26823b9 Double check the element is free in kore_pool_get(). 2014-03-06 08:20:05 +01:00
Joris Vink
1375190936 Improvements for client certificates.
Double check we actually get a certificate if we are asking for one.
Even though we set SSL_VERIFY_FAIL_IF_NO_PEER_CERT it's a sane thing to do.

Start logging the CN for the received client certificate in the access logs.

As a bonus re-arrange some accesslog stuff for sanity.
2014-03-05 11:38:47 +01:00
Joris Vink
75c4bb0754 Error out when we get an unknown NPN result. 2014-03-05 11:07:21 +01:00
Joris Vink
c408f9c1b3 Flairish 2014-03-02 18:17:30 +01:00
Joris Vink
d3d989d743 Update README with some flair 2014-03-02 18:16:32 +01:00
Joris Vink
c6e737c9c0 Bump to 1.1-current 2014-03-01 19:20:59 +01:00
Joris Vink
b7eafa6502 Bump to 1.1-release 1.1-release 2014-03-01 19:20:00 +01:00
Joris Vink
becfc8d586 Add request as an authentication_type.
request can be used for when you want to validate something for
authentication bmanually. Youur validator will receive the http_reques
passed down.

A practical use of this is doing IP based ACL's.
2014-03-01 19:18:30 +01:00
Joris Vink
cb17c0d610 When returning a 405 append an Allow header as per rfc 2014-02-27 22:24:28 +01:00
Joris Vink
634bb482d6 Pass the http_request responsible for calling the validator. 2014-02-01 17:47:58 +01:00
Joris Vink
ccd9e1046a Remove included docs, they are outdated. 2014-01-29 23:00:43 +01:00
Joris Vink
6e4b403662 Don't force the year in a HTTP-date to be the current year. 2014-01-29 22:59:58 +01:00
Joris Vink
f0a9c1fe73 Major improvements to HTTP/1.1 behaviour, error reporting and handling.
This comes with changes to http_response() (no longer returns a result).
2014-01-29 22:48:51 +01:00
Joris Vink
a80808d779 Add header as an option for authentication blocks 2014-01-22 23:11:52 +01:00
Joris Vink
9a8092bf41 Add authentication blocks for Kore.
Using authentication blocks one can define "authentication" mechanisms
in Kore for page handlers.

This can be used to require a session cookie (validated by your own validator)
for certain page handlers, and hopefully in the future provide a framework
for adding more authentication things (like HTTP Auth).

Right now only cookie checking is available.
2014-01-22 22:55:10 +01:00
Joris Vink
7e8371366f Make sure we properly close a SPDY stream if there's no data. 2014-01-14 22:22:26 +01:00
Joris Vink
b64f674db2 Handle SPDY streams better when sending data. 2014-01-14 21:43:45 +01:00
Joris Vink
517de46790 Kore can now do query strings without lots of dynamic handler voodoo.
Any handler can receive query strings, however if you do not specify
parameters allowed in a param {} block Kore will discard them.
2014-01-13 20:21:20 +01:00
Joris Vink
ef4289689f Only call module onload if its present 2014-01-11 01:35:44 +01:00
Joris Vink
d22405cea7 Call the onload function whenever a module is loaded/reload.
Allows one to teardown whatever they setup properly when
the module gets a full reload. See example module for how it works.
2013-12-21 13:37:34 +01:00
Joris Vink
ddf23ef65b Remove onload, it's gone 2013-12-17 11:48:53 +01:00
Joris Vink
84d2c7fa0d ULONG_MAX -> LONG_MAX 2013-12-16 18:00:33 +01:00
Joris Vink
21b148e3a5 Allow Kore to load multiple modules at once. 2013-12-15 01:11:56 +01:00
Joris Vink
f2aa206f3b Add support for client certificates 2013-12-14 16:31:07 +01:00
Joris Vink
08a2fff5a5 add params 2013-12-12 08:49:02 +01:00
Joris Vink
0f59c617df Add missing params for param-test 2013-12-12 11:36:45 +01:00
Joris Vink
be48cd56e1 ULONG_MAX -> LLONG_MAX 2013-12-12 01:15:40 +01:00
Joris Vink
f86673b97b Remove some stuff that wasn't suppose to be here 2013-12-12 01:04:35 +01:00
Joris Vink
c7dcdbcd82 Rework the way validation and param extraction works.
- Parameter validation is now done only when http_process_*()
  is called and upon http_argument_add().
- You MUST have defined your params in a param block or they will
  be filtered out.
- http_argument_lookup() is dead, welcome http_argument_get() and
  its brothers and sisters:
	http_argument_get_string()
	http_argument_get_uint16()
	http_argument_get_int16()
	http_argument_get_uint32()
	http_argument_get_int32()

  They will automatically do bounds checking on integers for you
  and return proper integers or a NUL-terminated string.

- The http_argument_get* functions no longer create an additional
  copy of the string which you need to free. Easier going.
- http_multiple_args() is dead, byebye
- Make some stuff we don't want to share with the modules static.
2013-12-12 00:58:32 +01:00
Joris Vink
b4c54f9dc0 indent 2013-12-11 19:13:50 +01:00