relay: do forward data if the http request type was HEAD

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
cgi: compare the physical path instead of the url to detect quirky urls

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
main: strdup command line arguments that are modified

This ensures that the process will show the correct command line in ps

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
fix handling of / as cgi prefix

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
cgi: add _GNU_SOURCE define to fix build error on musl

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
ubus: add CORS header support

In order to support cross-domain AJAX requests to the /ubus endpoint
we need to implement the Cross-Origin Resource Sharing (CORS) spec
in the ubus plugin.

- Implement a new option "-X" to enable CORS support in ubus
- Implement rudimentary support for "OPTIONS" HTTP requests
- Implement essential CORS headers the ubus plugin

The current CORS response headers merely reflect the request headers
sent by the client, this way any requesting origin is automatically
allowed. Cross-domain cookies (Access-Control-Allow-Credentials) are
unconditionally enabled.

Restricting permitted origins and toggle the credential accepting can
be made configurable in a future commit to allow more fine grained
control over permitted AJAX clients.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>