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
Joris Vink
d3f84db4b8
small fixes.
2017-02-01 21:36:53 +01:00
Joris Vink
7fb47da586
add http_file example to python example.
2017-02-01 21:35:44 +01:00
Joris Vink
6578fc6589
expose http_file interface to python.
2017-02-01 21:23:56 +01:00
Joris Vink
0250c8ecba
style
2017-02-01 21:20:43 +01:00
Joris Vink
261fb3c3fa
flesh out python example a bit more.
2017-02-01 17:15:18 +01:00
Joris Vink
3d8e0dabc0
expose kore_server_bind() and fatal() to python
2017-02-01 17:12:52 +01:00
Joris Vink
0c0a9371bd
Change kore_preload() and kore_onload().
...
Renamed both of them:
kore_preload -> kore_parent_configure
kore_onload -> kore_worker_configure
These functions will now always be called if they are defined in any module
regardless of your application being built as a single binary or not.
2017-02-01 17:12:11 +01:00
Joris Vink
8629419253
the example uses tls by default, so use it.
2017-01-31 09:21:06 +01:00
Joris Vink
bb9dbbec12
typo.
2017-01-30 22:47:41 +01:00
Joris Vink
6e7de9ab93
update python ws example.
2017-01-30 22:40:59 +01:00
Joris Vink
006f764d96
when getting OP_CLOSE disable reads.
2017-01-30 22:35:34 +01:00
Joris Vink
587a663f31
reorder ws disconnect order a bit.
2017-01-30 22:25:08 +01:00
Joris Vink
8b26ecdf14
more websocket improvements.
...
- send a CLOSE opcode if we haven't yet when removing a ws client.
- ignore unsolicited PONG.
2017-01-30 22:21:57 +01:00
Joris Vink
d5a32c2dab
use the correct opcode for PONG.
...
djees i can't hex.
2017-01-30 22:17:47 +01:00
Joris Vink
30666618f8
expose kore_websocket_send() to python.
2017-01-30 22:00:03 +01:00
Joris Vink
e4d87b72a0
websocket improvements.
...
- properly send a CLOSE control frame back if the client sent us one.
- make sure we can send messages that are exactly USHRT_MAX bytes long.
2017-01-30 21:52:22 +01:00
Joris Vink
6bfba49ba5
cleanup data if required.
2017-01-30 21:50:36 +01:00
Joris Vink
f78e8f2fd2
allow None as source for kore.websocket_broadcast.
...
This allows kore.websocket_broadcast() to be used to relay the
messages back to all clients rather then all except the sender.
2017-01-30 21:48:58 +01:00
Joris Vink
6a43dd529c
export WEBSOCKET_OP_TEXT and WEBSOCKET_OP_BINARY.
2017-01-30 21:02:58 +01:00
Joris Vink
3d3d705b98
flesh out the python stuff a bit more.
2017-01-30 20:47:24 +01:00
Joris Vink
7bc8bb42e2
implement kore_websockat_broadcast.
2017-01-30 20:30:42 +01:00
Joris Vink
5485967547
add websocket example to python
2017-01-29 22:57:55 +01:00
Joris Vink
7510834968
initial fudging to add websockets to python
2017-01-29 22:57:34 +01:00
Joris Vink
1ecb777d41
only remove the pgsql if it was scheduled.
...
fixes #172 .
2017-01-29 10:34:53 +01:00
Joris Vink
829066dc23
i can't port.
2017-01-26 22:02:11 +01:00
Joris Vink
4940f97079
remove stuff that is not ready yet and add README.
2017-01-26 22:01:23 +01:00
Joris Vink
c06ecf1c70
Teach single binaries about SIGHUP.
...
Make sure kore_onload() and kore_preload() can be called
either in native or python runtime.
2017-01-26 13:26:55 +01:00
Joris Vink
3023ca0e57
Allow single binaries to load modules again.
2017-01-26 13:13:23 +01:00
Joris Vink
dcb5fd842f
Expose get/post params via req.argument for python.
2017-01-26 12:01:28 +01:00
Joris Vink
1db3cd96d8
allow reloading of python modules on SIGHUP.
2017-01-26 11:13:09 +01:00
Joris Vink
2c66dfa3cf
add python_import to example config
2017-01-25 22:43:59 +01:00
Joris Vink
da13e1e768
undef _POSIX_C_SOURCE and _XOPEN_SOURCE before Python.h
2017-01-25 22:41:57 +01:00
Joris Vink
ef441fb9a1
bah, be gone.
2017-01-25 22:38:43 +01:00
Joris Vink
ff48aed926
initial python example.
...
don't look too much into this yet.
2017-01-25 22:38:06 +01:00
Joris Vink
21f9c29f31
style + move pyhttp_dealloc() into !KORE_NO_HTTP.
2017-01-25 22:33:39 +01:00
Joris Vink
f56938283d
Merge branch 'master' of github.com:jorisvink/kore
2017-01-25 22:23:34 +01:00
Joris Vink
38df26f59c
add first mentions of python support to README.
2017-01-25 22:22:05 +01:00
Joris Vink
5d09214591
only rebuild with "kore build" when we can.
2017-01-25 22:21:40 +01:00
Joris Vink
a9537bc6ec
add python flavor string to -v
2017-01-25 22:21:30 +01:00
Joris Vink
9976022a47
let python use kore backed memory allocators.
2017-01-25 22:07:58 +01:00