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
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
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
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
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
bb9dbbec12
typo.
2017-01-30 22:47:41 +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
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
7bc8bb42e2
implement kore_websockat_broadcast.
2017-01-30 20:30:42 +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
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
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
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
Joris Vink
e47806c669
allow memory allocators to deal with 0 bytes.
...
we just increase the lenght requested to 8 bytes if we get a 0 byte request.
additionally when kore_realloc() is called check if we actually have
to do the work, if not just return the original pointer.
2017-01-25 22:07:08 +01:00
Joris Vink
620cc231dc
validators now work in python.
2017-01-25 21:17:12 +01:00
Joris Vink
7c74a0824b
push all integers exported to python in a struct.
2017-01-25 20:56:57 +01:00
Joris Vink
bbcdec82fc
Add initial python support.
...
Based on work done by Stanislav Yudin.
2017-01-24 20:18:12 +01:00
Yorick de Wid
f7e8954609
BSD required AF_INET* headers ( #171 )
2017-01-18 22:24:49 +01:00
Joris Vink
98148155dc
bump copyright year
2017-01-18 10:27:44 +01:00
Joris Vink
2f8c173042
Improve ipv6 host parsing if we get a literal.
...
Fixes #169 .
2017-01-18 10:27:04 +01:00
Yorick de Wid
86d85dd10b
Message shutdown request ( #168 )
...
* Set server version
* Message shutdown request
* Update messaging example
* Set server verion in generic example
* Allow shutdown with NOHTTP=1
2017-01-17 18:18:01 +01:00
Yorick de Wid
565bf5bdec
Set server version ( #157 )
2017-01-13 13:03:47 +01:00
Joris Vink
57840a8366
Deal with the Host header in a way IPv6 hosts work
...
Fixes #164 .
2017-01-11 11:01:58 +01:00
Joris Vink
10929189a0
make sure we can call pgsql_conn_cleanup() properly.
2017-01-10 15:29:03 +01:00
Joris Vink
f5ad76a2c3
better description.
2016-12-29 20:15:01 +01:00
Joris Vink
fe7237fd74
Take over linker from env if present.
2016-12-29 20:14:16 +01:00