diff options
Diffstat (limited to 'package/network/services/uhttpd/files')
-rw-r--r-- | package/network/services/uhttpd/files/uhttpd.config | 8 | ||||
-rwxr-xr-x | package/network/services/uhttpd/files/uhttpd.init | 15 |
2 files changed, 23 insertions, 0 deletions
diff --git a/package/network/services/uhttpd/files/uhttpd.config b/package/network/services/uhttpd/files/uhttpd.config index 40ce67fd01..a9b8ff3d15 100644 --- a/package/network/services/uhttpd/files/uhttpd.config +++ b/package/network/services/uhttpd/files/uhttpd.config @@ -57,6 +57,14 @@ config uhttpd main # matches have precedence over the CGI prefix. list lua_prefix "/cgi-bin/luci=/usr/lib/lua/luci/sgi/uhttpd.lua" + # List of prefix->ucode handler mappings. + # Any request to an URL beneath the prefix + # will be dispatched to the associated ucode + # handler script. Ucode support is disabled when + # no handler mappings are specified. Ucode prefix + # matches have precedence over the CGI prefix. +# list ucode_prefix "/ucode/example=/usr/share/example.uc" + # Specify the ubus-rpc prefix and socket path. # option ubus_prefix /ubus # option ubus_socket /var/run/ubus/ubus.sock diff --git a/package/network/services/uhttpd/files/uhttpd.init b/package/network/services/uhttpd/files/uhttpd.init index 30fd7b4259..8dbc23f59c 100755 --- a/package/network/services/uhttpd/files/uhttpd.init +++ b/package/network/services/uhttpd/files/uhttpd.init @@ -91,6 +91,18 @@ append_lua_prefix() { fi } +append_ucode_prefix() { + local v="$1" + local prefix="${v%%=*}" + local handler="${v#*=}" + + if [ "$prefix" != "$handler" ] && [ -n "$prefix" ] && [ -f "$handler" ]; then + procd_append_param command -o "$prefix" -O "$handler" + else + echo "Skipping invalid ucode prefix \"$v\"" >&2 + fi +} + start_instance() { UHTTPD_CERT="" @@ -142,6 +154,9 @@ start_instance() append_arg "$cfg" ubus_socket "-U" append_bool "$cfg" ubus_cors "-X" 0 } + [ -f /usr/lib/uhttpd_ucode.so ] && { + config_list_foreach "$cfg" ucode_prefix append_ucode_prefix + } append_arg "$cfg" script_timeout "-t" append_arg "$cfg" network_timeout "-T" append_arg "$cfg" http_keepalive "-k" |