uhttpd: update to latest Git HEAD
[openwrt/openwrt.git] / package / network / services / uhttpd / files / uhttpd.init
index 30fd7b4259d93f275177aba3af3e633df0b13832..8dbc23f59c1e0120d89ca8c5c84272e63ec4618f 100755 (executable)
@@ -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"