Commit Graph

1494 Commits

Author SHA1 Message Date
Joris Vink 73ae195693 next 2019-06-05 10:44:16 +02:00
Joris Vink f389d5119b Merge branch 'master' into 3.3.0-releng 2019-06-05 10:44:11 +02:00
Joris Vink 89e58fa474 Improve iterator support for Python req.response().
If the connection on which we are about to send the response was
marked as disconnecting, do not go ahead and hook into the disconnect
callback (it will never be called, it is already disconnecting).

Instead just return, the connection will be removed anyway.
2019-06-05 10:35:47 +02:00
Joris Vink 93b1d621d7 Remove memleak from Python httpclient.
We grab a reference to the pyhttp_client for the client_op data structure
but never removed it. This caused the pyhttp_client object to never
be released when out of scope.
2019-06-05 10:27:20 +02:00
Joris Vink ea59ee7a32 3.3.1-release 2019-06-03 15:29:24 +02:00
Joris Vink 64a008c06e 3.3.1-rc2 2019-06-03 15:07:31 +02:00
Joris Vink da4eda238f Merge branch 'master' into 3.3.0-releng 2019-06-03 15:07:21 +02:00
Joris Vink a4d18ca276 Add HTTP runlocks.
A way to serialize access to HTTP page handlers in case you are
using some asynchronous api such as pgsql or libcurl stuff.
2019-06-02 16:29:54 +02:00
Joris Vink 1686ec22e6 Some C pgsql api improvements. 2019-06-01 23:14:50 +02:00
Joris Vink 44cc14d602 move to 3.3.1-rc1 2019-05-31 09:15:55 +02:00
Joris Vink ea9fad0970 Merge branch 'master' into 3.3.0-releng 2019-05-31 09:15:24 +02:00
Joris Vink ff7c85460c Wake up HTTP requests if python coros finish immediately.
python_coro_create() puts the HTTP request to sleep, but if they
finish immediately they will be removed from the list and should
properly be woken up or they are removed from the wrong list.
2019-05-30 17:15:08 +02:00
Joris Vink a8aff8b737 Improve curl error string handling.
Introduce kore_curl_strerror(), use this in kore_curl_logerror()
instead of assuming our errbuf has been populated.

Also use it in the python httpclient when throwing an exception rather
then looking at the errbuf member which may or may not be empty.
2019-05-30 14:25:04 +02:00
Joris Vink 88553cd2dd Immediately remove completed HTTP requests.
No need to wait until the next time http_process() is called, which
could result in HTTP requests backing up even though we are processing
them at a fast pace.
2019-05-29 20:30:43 +02:00
Joris Vink 07fc7a9097 Improve HTTP processing.
If netwait is INFINITE but there are requests pending reduce the
netwait back down to 100ms so we keep processing them.
2019-05-29 15:27:44 +02:00
Joris Vink c2d9f1413c Fix two concurrency issues with kore.lock().
1) If a coroutine was waken up by another releasing a lock it was waiting
on we would incorrectly remove the pylock_op when the newly awoken coroutine
hits the iternext for pylock.

2) If a coroutine attempts to grab a lock it was woken up for only to fail
we did not properly rearm the coroutine to be woken up later to try again.
2019-05-29 15:25:31 +02:00
Joris Vink 5f0153ba0e Fix unix binds on BSD families. 2019-05-28 21:44:46 +02:00
Joris Vink b4aba48fad small python improvements.
- Check for an exception when in a timer context and log it if uncaught.
- Make sure tlsverify is settable regardless of client certs being specified.
2019-05-16 21:07:42 +02:00
Joris Vink 500023a936 3.3.0-release 2019-05-14 21:52:35 +02:00
Joris Vink 893f815055 Merge branch 'master' into 3.3.0-releng 2019-05-14 21:51:37 +02:00
Joris Vink 41366ba583 avoid using pkg-config on FreeBSD for CURL=1. 2019-05-14 20:53:27 +02:00
Joris Vink 34e3ba1318 remove lingering pyko references 2019-05-13 23:23:33 +02:00
Joris Vink 7a814f5786 less lies, more truth. 2019-05-13 23:14:12 +02:00
Joris Vink a10dfe03fe make sure user-defined headers are set for > 500.
a commit done in 2018 prevented http responses with error codes
> 500 to include any user-set headers, preventing a developer
to include things like content-type etc.

reported by Arun Babu via users@
2019-05-12 20:53:27 +02:00
Joris Vink fdd12f49ac 3.3.0-rc3 2019-05-11 11:24:52 +02:00
Joris Vink 76490c3d58 Merge branch 'master' into 3.3.0-releng 2019-05-11 11:24:38 +02:00
Joris Vink 53f042a5b4 add stdint.h header to keymgr.c 2019-05-09 20:55:49 +02:00
Joris Vink 917d4d7636 add missing options.
from Daniel Chavez via patches@
2019-05-07 19:53:19 +02:00
Joris Vink a050760a35 3.3.0-rc2 2019-05-06 08:32:39 +02:00
Joris Vink 28ba0f39a7 Merge branch 'master' into 3.3.0-releng 2019-05-06 08:32:30 +02:00
Joris Vink 3299f60df4 tiny curl fixes. 2019-05-05 21:16:42 +02:00
Joris Vink 503f42074c http_timeout must be 0 when upgrading to websockets
otherwise kore will timeout an established websocket connection
after http_timeout seconds.
2019-05-05 14:47:04 +02:00
Joris Vink 5ec67403c1 add RELEASE file on releng 2019-05-04 00:11:46 +02:00
Joris Vink fe84997ce9 add option to use unix paths via kore.httpclient 2019-05-03 15:31:16 +02:00
Joris Vink 3c9a141cd0 allow an iterator to be passed to req.response().
if an iterator is passed kore will send the response with
transfer-encoding: chunked and call the iterator for every
chunk that was sent.

The iterator must return a utf-8 string.

Works wonderful with TemplateStream from jinja2.
2019-05-03 13:42:34 +02:00
Joris Vink c8878ebcde mention libcurl support in README 2019-05-01 22:40:27 +02:00
Joris Vink b8ceab37bf use name instead of c->ssl->session things 2019-04-30 21:06:27 +02:00
Joris Vink 12fc1396c1 use / to split up name/version. 2019-04-30 20:45:56 +02:00
Joris Vink 98929263e0 update example for more recent openssl libs. 2019-04-30 20:41:38 +02:00
Joris Vink 502368a27e set user-agent in the curl component. 2019-04-30 20:39:46 +02:00
Joris Vink 4ceb947633 add async-curl example to the makefile 2019-04-30 20:38:12 +02:00
Joris Vink c4b5984cde remove stale example from Makefile 2019-04-30 20:32:37 +02:00
Joris Vink 403938d8e9 make native proctitle better.
count how much space is available for a mangled process title
only once, and use that as reference later.
2019-04-29 21:08:58 +02:00
Joris Vink d0a6958747 Let http_state_create() take an "onfree" callback.
This function is called when an HTTP request is being free'd,
allowing you to perform any sort of state cleanup attached
to the HTTP request.
2019-04-28 21:48:16 +02:00
Joris Vink 9ac77d0c9a make sure CURL_CSELECT_ERR is OR'd into flags. 2019-04-28 21:44:59 +02:00
Joris Vink e54886960e objs is a pointer, and use Py_XDECREF on it. 2019-04-25 23:25:19 +02:00
Joris Vink d0d0bdeb4f Improve pgsql support.
- Add kore_pgsql_query_param_fields() which allows you to pass in the
  arrays for values, lengths and formats yourself.

- Add kore_pgsql_column_binary() which will return 1 if the given column
  index contains a binary result or 0 if it contains a text result.

- Change the query call in req.pgsql() for Python to always use the
  parameterized queries.

This adds the 'params' and 'binary' keywords to the req.pgsql method.

Eg:
	result = await req.pgsql("db", "INSERT INTO foo (field) VALUES($1"),
	    params=["this is my value"])
2019-04-25 23:13:13 +02:00
Joris Vink 2c983e338c undefine _FORTIFY_SOURCE before defining it.
Fixes building with compilers/distributions that set it by default.

From Bryan Baldwin via patches@
2019-04-25 20:09:11 +02:00
Joris Vink 994f428a8d add cabundle keyword to kore.httpclient() 2019-04-24 21:09:24 +02:00
Joris Vink 6bd3d92fe2 unbreak. 2019-04-24 18:30:07 +02:00