1123 Commits

Author SHA1 Message Date
Joris Vink
edc356ca60 no need for -rdynamic in kodev. 2017-02-22 13:01:53 -08:00
Joris Vink
00ce970efe Be less noisy about module reloading.
No longer show "not reloading foo" if timestamps didn't change.
Be more clear about a module forcing us to not reload it.
2017-02-22 12:48:06 -08:00
Joris Vink
d09eb5e107 bump copyright 2017-02-22 21:37:14 +01:00
Joris Vink
e89e644d10 call PyErr_Clear() before PyImport_ReloadModule(). 2017-02-22 20:54:57 +01:00
Joris Vink
93ab52dcf5 Add a reload command to the cli tool.
This will look at the kore.pid file in the current directory
and send a SIGHUP signal to it. It's mostly a handy shortcut
since you could of course do a kill -HUP `cat kore.pid` easily.
2017-02-22 20:38:24 +01:00
Joris Vink
970356a3e9 always write the pidfile even in foreground 2017-02-22 20:38:07 +01:00
Joris Vink
6e6d2f005d Remove leftover feature defines from kodev. 2017-02-22 20:13:59 +01:00
Joris Vink
ead0a4199c add little hint for kodev. 2017-02-22 20:09:11 +01:00
Joris Vink
541870c10a Improve keymgr_await_data().
Before this function would block client I/O and existing HTTP requests
until the keymgr process responsed with a result.

This commit changes that behaviour and makes this function call
the http_process() function if we end up waiting for the keymgr.

This means that while waiting for a response we at least start
making headway with existing HTTP requests if the response is
not immediate.
2017-02-22 18:30:50 +01:00
Joris Vink
c6ca68f3f2 export http_body_path via python 2017-02-22 17:52:57 +01:00
Joris Vink
2f670ce777 don't log failure if unlinking fails with ENOENT 2017-02-22 17:52:38 +01:00
Joris Vink
fc6b3bf740 Split up kore cli tools into new binary.
Having the create, build, run tools baked into the kore binary
made things harder then they had to be for multiple projects with
each different build flavors.

So move away this functionality into a new "kodev" (name may change)
binary that is installed next to kore.

The new build tools will automatically pick up the correct flavors
the kore binary it points to is installed with. Or for single builds
what flavors where enabled.

The new tool also will honor looking into PREFIX for the kore binary
when doing a `kodev run`.

Additionally add a new command "info" that shows some basic info
about your project and how it will be built. For example it will
show you the flavors of the kore binary installed on the system
or the flavors you configured for a single binary build.

Obligitory, hacking on a plane comment.
2017-02-19 00:52:29 -05:00
Joris Vink
a0c545884f even more ssl to tls terminology. 2017-02-11 21:33:09 +01:00
Joris Vink
98f0c41f38 more ssl -> tls wording 2017-02-11 21:30:38 +01:00
Joris Vink
9be3c22196 like other flavors, log if python is enabled. 2017-02-09 13:38:09 +01:00
Joris Vink
37443df6b0 Slightly change kore_parent_configure() again.
- Call it before loading configurations when built as single binaries.
- Call it right before forking workers when built as a dso.
2017-02-09 13:36:08 +01:00
Joris Vink
311e658d57 call to kore_parent_configure() before config. 2017-02-09 13:29:33 +01:00
Joris Vink
625d50b8dd use rootdir when making paths to features/ldflags. 2017-02-09 11:45:11 +01:00
Joris Vink
e895446dfa Improve single binary builds.
Allow kore build to pickup the required libraries for kore when
building single binaries so that you no longer have to manually
add them to ldflags.
2017-02-09 11:30:44 +01:00
Joris Vink
d2cfc2b554 shuffle headers around. 2017-02-07 23:21:18 +01:00
Joris Vink
a43d968f0f add little note on non mixables. 2017-02-07 23:18:05 +01:00
Joris Vink
4e9399d553 use SSL_OP_SINGLE_ECDH_USE. 2017-02-07 23:17:11 +01:00
Joris Vink
06ae4644e0 spacing & style 2017-02-07 23:04:24 +01:00
Joris Vink
e9b4f966c2 expose new cookie stuff to python.
req.populate_cookies()
value = req.cookie("name")
2017-02-07 22:54:42 +01:00
Joris Vink
b8c6cddc3d Revert "TAILQ_FOREACH_SAFE() exists so use it."
Because some asshole distributions claim to have a sane queue.h
implementation while they do not.
2017-02-07 22:44:20 +01:00
Joris Vink
0ea911140e TAILQ_FOREACH_SAFE() exists so use it. 2017-02-07 22:35:09 +01:00
Joris Vink
7c78dea211 more cookie example improvements.
- remove unneed headers.
- rename local to avoid shadowing.
2017-02-07 22:12:56 +01:00
Joris Vink
233d5d1708 remove unneeded NULL check before calling free. 2017-02-07 22:08:04 +01:00
Joris Vink
4e556dbd8f rename example cookies source file. 2017-02-07 22:06:31 +01:00
Joris Vink
1296802e06 fixup isspace arguments. 2017-02-07 22:06:14 +01:00
Joris Vink
36e99072f3 cookie example improvements. 2017-02-07 22:04:00 +01:00
Joris Vink
8b9ea825eb cookie improvements.
- split up writing of cookies into its own function.
- turn maxage into a signed int and use -1 for it not being set.
- lots of style fixes
- remove HTTP_COOKIE_DEFAULT, just pass 0 if you don't want flags.
2017-02-07 22:03:06 +01:00
Stanislav Yudin
f4ac8c2955 Cookies and arguments parsing improvements (#166)
Add new cookie API for handling of cookies.
2017-02-07 21:49:10 +01:00
Joris Vink
23d5e9b341 reword 2017-02-06 23:38:21 +01:00
Joris Vink
5a16bdbe65 whitespace 2017-02-06 22:53:09 +01:00
Joris Vink
f80a9cbc6c actually urldecode parameter names. 2017-02-06 22:47:32 +01:00
Joris Vink
604fae3a01 unfuck parsing http_body_max. 2017-02-06 21:28:33 +01:00
Joris Vink
c25c1c5281 pgsql: don't do a PQcancel() if it's not needed. 2017-02-06 20:01:16 +01:00
Joris Vink
09b0ae6d42 rename local sin to avoid potential conflicts. 2017-02-06 19:54:50 +01:00
Joris Vink
b8b8373702 when exiting clear any lingering python exceptions. 2017-02-06 16:54:38 +01:00
Joris Vink
21bf7f9583 rework base example a bit. 2017-02-06 12:21:40 +01:00
Joris Vink
01e3ef6cd3 no need to log ignored signals. 2017-02-06 12:13:34 +01:00
Joris Vink
6592eddcfb add stdint.h 2017-02-06 12:13:29 +01:00
Joris Vink
9f3046bae7 add README 2017-02-06 11:52:24 +01:00
Joris Vink
0bf36b763a add new python-pgsql example 2017-02-06 11:51:49 +01:00
Joris Vink
ace8c4e80c Add asynchronous pgsql query support to python.
This commit adds the ability to use python "await" to suspend
execution of your page handler until the query sent to postgresql
has returned a result.

This is built upon the existing asynchrous query framework Kore had.

With this you can now write stuff like:

async def page(req):
	result = await req.pgsql("db", "SELECT name FROM table");
	req.response(200, json.dumps(result).encode("utf-8"))

The above code will fire off a query and suspend itself so Kore can
take care of business as usual until the query is successful at which
point Kore will jump back into the handler and resume.

This does not use threading, it's purely based on Python's excellent
coroutines and generators and Kore its built-in pgsql support.
2017-02-06 11:42:53 +01:00
Joris Vink
80698ee40a add kore_mem_cleanup() to cleanup pools at exit. 2017-02-06 11:42:23 +01:00
Joris Vink
de7a6d4855 pgsql improvements.
- adds new cleanup function that workers will call.
- adds kore_pgsql_nfields() to return number of fields in result.
- add kore_pgsql_fieldname() to return name of a given field.

This commit also changes the behaviour of pgsql_conn_release() in
that it will now cancel the active query before releasing the connection.

This makes sure that if long running queries are active they are hopefully
cancelled if an http request is removed while such queries are still running.
2017-02-06 11:40:33 +01:00
Joris Vink
c3d2984939 fix parameters to kore_log(). 2017-02-06 11:39:50 +01:00
Joris Vink
76cb532de9 mark kore_log with printf attribute.
'bout time.
2017-02-06 11:39:30 +01:00