ubus: fix handling of empty JSON-RPC batches

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
disable keep-alive for POST requests to improve compatibility

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
disable connection_close override if a keep-alive header is found

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
detect chrome before safari, chrome includes Safari/ in the UA header

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
proc: consume all data after the pipe dies, instead of looping with 100% cpu usage

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
client: prevent further read calls after a client has been freed

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
ubus: use per-request blob buffer to fetch list results, fixes global buffer corruption with concurrent requests
ubus: move sid into the params array of the json-rpc request to avoid information leakage via the post url
ubus: pass current session id as ubus_rpc_session attribute to any called procedure
ubus: deny requests with a "ubus_rpc_session" toplevel attribute to prevent injecting different SIDs
ubus: fix session example script to conform to new rpc protocol
ubus: use "ubus_rpc_session" instead of "sid" attribute name when querying session.access
main: return after processing -d switch
lua: fix lua 5.2 compatibility

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
uhttpd: fix crashes in the ubus plugin

The ubus plugin calls blocking ubus functions that loop back into
uloop_run. Protect the client data structure with refcounting to ensure
that the outer uloop_run call does not clean up the data that the inner
uloop_run call is still processing.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
ubus: remove indentation and whitespace from JSON responses to conserve a bit of bandwidth