Commit Graph

10 Commits

Author SHA1 Message Date
Frederic Cambus 582e18d2ec Stop hardcoding HTTP error codes in http_response() calls.
Use predefined HTTP_STATUS_* macros instead.
2021-05-02 16:03:18 +02:00
Joris Vink dcb34033fa trailing whitespace 2020-05-08 22:43:12 +02:00
Raphaël Monrouzeau 06d9ca96da JSONRPC Updated to last kore_buf* commit 2016-07-15 13:17:30 +02:00
Raphaël Monrouzeau 32ac27d4c3 JSONRPC Reverted explicit deallocation calls
The possibility to call jsonrpc_destroy_request was left. Someone may
want to abruptly interrupt the process of its request for some odd
reason, in that case an exlicit call still would be to be made.
2016-07-15 13:08:08 +02:00
Raphaël Monrouzeau a818555c96 JSONRPC use size_t to get in line with last commit
Kore now uses size_t for kore_buf and http_response() so response size
check is useless and u_int32_t variables should be converted.
2016-07-15 13:08:08 +02:00
Raphaël Monrouzeau 016dc27346 JSONRPC Made request destruction explicit
Caller has now to destroy jsonrpc_request after use. This permits them
to read / inspect it after having responded.
2016-07-15 13:08:08 +02:00
Raphaël Monrouzeau 8c78b28be3 JSONRPC Removed upload size limit check
A true application dependant limit check would require stream parsing.
As the limit enforcement was done, it added nothing of value compared
to HTTP request limit check, which is in Kore already.
2016-07-15 13:08:08 +02:00
Raphaël Monrouzeau 3366ec6573 Required params to be structured as per spec 2016-07-15 13:08:08 +02:00
Raphaël Monrouzeau 4ffe43cf87 Compliantly don't return anything to notifications
And don't return anything either if protocol doesn't match.
2016-07-15 13:08:08 +02:00
Raphaël Monrouzeau db02e990ea JSON-RPC support for Kore.
The API surface is very limited. Jsonrpc support reads request from HTTP
body and such can't be activated if NOHTTP=1. At the moment there is no
websocket support either (which is a shame). It depends upon the
third-party Yajl library.

Errors can be emitted using jsonrpc_error() and results using
jsonrpc_result(), for the later you'll have to provide a callback which
will write the inner of the result object.

If errors happen during the response write process, no further error
output will be attempted and an HTTP error 500 will be returned.

Read the provided example for getting a better idea of the API.
2016-07-15 13:08:08 +02:00