Joris Vink
9718d6b7bb
Add dns pledge for openbsd to the async-url config.
2019-04-24 16:02:25 +02:00
Joris Vink
1b9ba84ab0
missing return value check.
2019-04-24 09:33:56 +02:00
Joris Vink
a9683caed5
missing header
2019-04-24 00:16:51 +02:00
Joris Vink
2c88bc6120
Add asynchronous libcurl support.
...
This commit adds the CURL=1 build option. When enabled allows
you to schedule CURL easy handles onto the Kore event loop.
It also adds an easy to use HTTP client API that abstracts away the
settings required from libcurl to make HTTP requests.
Tied together with HTTP request state machines this means you can
write fully asynchronous HTTP client requests in an easy way.
Additionally this exposes that API to the Python code as well
allowing you do to things like:
client = kore.httpclient("https://kore.io ")
status, body = await client.get()
Introduces 2 configuration options:
- curl_recv_max
Max incoming bytes for a response.
- curl_timeout
Timeout in seconds before a transfer is cancelled.
This API also allows you to take the CURL easy handle and send emails
with it, run FTP, etc. All asynchronously.
2019-04-24 00:15:17 +02:00
Joris Vink
c89ba3daa3
check http timeouts better
2019-04-12 14:26:47 +02:00
Joris Vink
612fc034fa
remove debug
2019-04-11 20:54:29 +02:00
Joris Vink
aa49e181b6
Add http_[header|body]_timeout.
...
If the HTTP request headers or the HTTP body have not arrived before
these timeouts expire, Kore will send a 408 back to the client.
2019-04-11 20:51:49 +02:00
Joris Vink
a191445f76
set body length+offset to 0 when populating data.
...
otherwise this isn't properly picked up by http_body_read() later
if dealing with in-memory HTTP bodies and you get inconsistent behaviour.
2019-04-02 22:26:44 +02:00
Joris Vink
5d16a7a123
make sure stdint.h is always included.
...
unbreaks NOTLS=1 and NOSENDFILE=1 builds on several platforms.
reported by Sam on irc, thanks.
2019-03-29 19:25:27 +01:00
Joris Vink
a66d259271
kill debug line
2019-03-29 19:15:10 +01:00
Joris Vink
d2aa64df5c
add kore_proctitle().
...
manipulates the argv+environ pointers to get a sensible process title
under linux / darwin.
2019-03-29 16:24:14 +01:00
Joris Vink
92fb4974b1
only deschedule if not -1.
2019-03-27 22:15:35 +01:00
Joris Vink
39ffa047ca
remove dh parameter check at configure time.
...
this is done when the workers startup if a domain with tls was used.
2019-03-26 21:44:44 +01:00
Joris Vink
e4caac9e0c
Be more clear when an invalid TLS setup is found
2019-03-26 21:36:45 +01:00
Joris Vink
bf42e56c7d
kill whitespace
2019-03-26 20:24:46 +01:00
Joris Vink
4ca7f29649
Add a concurrency parameter to kore.gather()
2019-03-25 10:13:52 +01:00
Joris Vink
e1766e74ba
always capture worker processes exiting.
...
even if they terminated normally.
2019-03-22 10:29:14 +01:00
Joris Vink
2445fd7bbd
use correct values for the option.
2019-03-22 09:52:00 +01:00
Joris Vink
4238431b9e
Add worker_death_policy setting.
...
By default kore will restart worker processes if they terminate
unexpected. However in certain scenarios you may want to bring down
an entire kore instance if a worker process fails.
By setting worker_death_policy to "terminate" the Kore server will
completely stop if a worker exits unexpected.
2019-03-22 09:49:50 +01:00
Joris Vink
cd80685d9d
get rid of pyko
2019-03-21 21:37:16 +01:00
Joris Vink
b9a714de65
remove pyko
2019-03-21 21:35:24 +01:00
Joris Vink
58c2739dee
If fd is -1 in pysock_op_iternext just return None.
...
None in pysock signals EOF and if it was closed under our feet we should
relay that properly.
2019-03-21 14:44:41 +01:00
Joris Vink
370041656e
Get rid of WORKER_LOCK_TIMEOUT.
...
Instead let the workers send a message on the msg channel to each
other when they have given up the accept lock and it is now available
to be grabbed.
2019-03-21 14:03:11 +01:00
Joris Vink
8b0279879a
rework timers so they fire more predictably.
...
this change also stops python coroutines from waking up very
late after their timeout has expired.
in filerefs, don't prime the timer until we actually have something
to expire, and kill the timer when the last ref drops.
2019-03-21 10:17:08 +01:00
Joris Vink
ce012e7bd5
set fd to -1 on close.
2019-03-21 10:09:24 +01:00
Joris Vink
d371454dad
do not grab the result if it was in a gatherop
2019-03-19 13:58:00 +01:00
Joris Vink
8afaac9fde
log pid number of worker upon start.
2019-03-19 13:42:22 +01:00
Joris Vink
681a88d535
simplify af_unix recvfrom/sendto support.
2019-03-19 13:27:50 +01:00
Erik Karlsson
d60994abb5
add python sendto recvfrom abstract socket support
2019-03-19 11:11:44 +01:00
Joris Vink
9caa45a050
Allow python validator methods to be async.
2019-03-18 09:34:31 +01:00
Joris Vink
c3ab570f56
Append full module path if it is a directory.
2019-03-16 16:13:52 +01:00
Joris Vink
31b6365da3
include sys/types.h explictly.
2019-03-14 19:20:46 +01:00
Joris Vink
ec7c8b8e1d
fix a few minor problems with pylock.
...
- when pylocks are deallocated we ended up deleting the wrong object.
- do not call Py_DECREF on the op when inside the op its iternext call.
2019-03-14 17:31:57 +01:00
Joris Vink
2217c7a2c8
pysock: call disable read/write only when needed
2019-03-14 09:27:13 +01:00
Joris Vink
d41054bd26
remove the socket from the event queue on dealloc.
2019-03-13 16:01:42 +01:00
Joris Vink
b06160c768
Make sure coros are woken up on eof.
2019-03-13 15:45:55 +01:00
Joris Vink
3b4574d791
Rework pysocket async/await.
...
Attach the events directly to the pysocket data structure instead of
one event per pysocket_op.
Makes the code easier, gives us a good performance boost and reduces
the number of system calls required when doing an await on a socket.
2019-03-13 11:07:15 +01:00
Joris Vink
01f9b4fcde
Check for EAGAIN when calling connect(2).
...
Linux does this under certain conditions.
2019-03-12 20:04:08 +01:00
Joris Vink
eb9b7f7b14
explicitly include sys/types.h
...
some smaller libc variants do not include this from sys/param.h.
2019-03-06 09:29:46 +01:00
Joris Vink
61863bfd3a
kill recv() timer if we have data.
...
also reset any exception that is set when we have successfully
read data from a socket.
2019-03-04 16:37:25 +01:00
Joris Vink
a0c203f507
remove norwegian debug
2019-03-01 20:57:31 +01:00
Joris Vink
31a9a70d5a
cleanup.
2019-03-01 20:56:03 +01:00
Erik Karlsson
01c1a8f8f8
support AF_UNIX in recvfrom()/sendto() python sockets
2019-03-01 20:13:28 +01:00
Joris Vink
2057f4db58
sprinkle more kore_quiet around
2019-02-27 19:59:31 +01:00
Joris Vink
1ebd82969c
Add timeout support to proc.recv()
2019-02-26 15:22:55 +01:00
Joris Vink
f4cd70956b
Add an optional timeout to socketop.recv().
2019-02-25 10:35:00 +01:00
Joris Vink
1e7ccc2adf
remove stale python example.
2019-02-25 10:00:59 +01:00
Joris Vink
bf1e8e5ffb
bump copyright to 2019
2019-02-22 16:57:28 +01:00
Joris Vink
3dbb80463a
allow double quotes in kore.proc argument lists.
2019-02-22 16:56:34 +01:00
Joris Vink
66305e551a
sig_recv is extern'd in kore.h
2019-02-11 14:01:25 +01:00