From patchwork Fri Aug 20 13:11:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stijn Tintel X-Patchwork-Id: 1519040 X-Patchwork-Delegate: stijn@linux-ipv6.be Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=r2Ly8Vhy; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linux-ipv6.be header.i=@linux-ipv6.be header.a=rsa-sha256 header.s=502B7754-045F-11E5-BBC5-64595FD46BE8 header.b=BipII9T0; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Grhsz3FQvz9s1l for ; Fri, 20 Aug 2021 23:13:59 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Dxw7atu76L/aBQntt7pW1jTYPCULL0mkcY2U1BYT2sI=; b=r2Ly8VhysFZseN kLaheAFj130coCdyeHSxT/951GnDDBkmyursFZAP2hBLaKv9Z+9HpHIGM3sOiNhM/zDKfabNJ/1D2 CV4iyPpVkhRxG9t6HPpPx94E6J5Oknl7l6eyL04DWUB28EzXcoBSMiP0zYsoOWjI8sQO8wITNp6hf neAM1VlZlNb22n5/Wu5oD1RoEiMUS5GeyhU7kEFEWpC45rcpyuQdvHpPLMn5GkcqCOO6i90E7BKAK ipYG2tptIjqjrmR+nC6CPRavA+hSG/o6HzDSYNJvWmgVjCc6RpN/xliN03Rum4+mbDtMEB4Wpidmj FepfgPqKxWRJ0UiXBJew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mH4J2-00BF23-C2; Fri, 20 Aug 2021 13:11:32 +0000 Received: from mail.tintel.eu ([51.83.127.189]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mH4Iw-00BF1P-CR for openwrt-devel@lists.openwrt.org; Fri, 20 Aug 2021 13:11:30 +0000 Received: from localhost (localhost [IPv6:::1]) by mail.tintel.eu (Postfix) with ESMTP id 1BE4C4486AC4; Fri, 20 Aug 2021 15:11:14 +0200 (CEST) Received: from mail.tintel.eu ([IPv6:::1]) by localhost (mail.tintel.eu [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id npDXmiQngdDU; Fri, 20 Aug 2021 15:11:13 +0200 (CEST) Received: from localhost (localhost [IPv6:::1]) by mail.tintel.eu (Postfix) with ESMTP id 5B1EC4486ACC; Fri, 20 Aug 2021 15:11:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.tintel.eu 5B1EC4486ACC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-ipv6.be; s=502B7754-045F-11E5-BBC5-64595FD46BE8; t=1629465073; bh=3YKw9bephsRsf4MDuHSX4MioHjRWefi/5PEc54pFn4g=; h=From:To:Date:Message-Id:MIME-Version; b=BipII9T0eY8ENYqcdZ7rxKFn6rwkKKOhJ2IoeLZ1fx4lgpPuGWsZrexzqU6mYTDRa Aihei2/ovPeWgUDbzfjNC9hIqv0fXRaEW0sCAPZGOP6gNHWNCkJxuPqYI+4pjijRRt 6YYC2qCi8DqzQJv7St1FqeVFoIaF8SfbniBW+1N4= X-Virus-Scanned: amavisd-new at mail.tintel.eu Received: from mail.tintel.eu ([IPv6:::1]) by localhost (mail.tintel.eu [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id J5m0pY66LdR7; Fri, 20 Aug 2021 15:11:13 +0200 (CEST) Received: from taz.sof.bg.adlevio.net (unknown [IPv6:2001:67c:21bc:20::10]) by mail.tintel.eu (Postfix) with SMTP id 17DF94486AC4; Fri, 20 Aug 2021 15:11:13 +0200 (CEST) Received: (nullmailer pid 141125 invoked by uid 1000); Fri, 20 Aug 2021 13:11:12 -0000 From: Stijn Tintel To: openwrt-devel@lists.openwrt.org Cc: nbd@nbd.name Subject: [PATCH] uhttpd: add config option for json_script Date: Fri, 20 Aug 2021 16:11:12 +0300 Message-Id: <20210820131112.141077-1-stijn@linux-ipv6.be> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Rspamd-Queue-Id: 17DF94486AC4 X-Spamd-Result: default: False [0.00 / 15.00]; IP_WHITELIST(0.00)[2001:67c:21bc:20::10]; ASN(0.00)[asn:200533, ipnet:2001:67c:21bc::/48, country:BG] X-Rspamd-Server: skulls X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210820_061126_592239_17869382 X-CRM114-Status: UNSURE ( 9.50 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Add a config option for json_script instead of unconditionally including all json files in /etc/uhttpd in every uhttpd instance. This makes it possible to configure a single instance with an unconditi [...] Content analysis details: (0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.1 DKIM_INVALID DKIM or DK signature exists, but is not valid X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Add a config option for json_script instead of unconditionally including all json files in /etc/uhttpd in every uhttpd instance. This makes it possible to configure a single instance with an unconditional redirect, which is currently not possible as it would render all other uhttpd instances unusable. Signed-off-by: Stijn Tintel Acked-by: Felix Fietkau --- package/network/services/uhttpd/Makefile | 2 +- package/network/services/uhttpd/files/uhttpd.init | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package/network/services/uhttpd/Makefile b/package/network/services/uhttpd/Makefile index 781512bd99..dce5aa87b8 100644 --- a/package/network/services/uhttpd/Makefile +++ b/package/network/services/uhttpd/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uhttpd -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git diff --git a/package/network/services/uhttpd/files/uhttpd.init b/package/network/services/uhttpd/files/uhttpd.init index e7709941c2..30fd7b4259 100755 --- a/package/network/services/uhttpd/files/uhttpd.init +++ b/package/network/services/uhttpd/files/uhttpd.init @@ -196,7 +196,8 @@ start_instance() append_bool "$cfg" redirect_https "-q" 0 } - for file in /etc/uhttpd/*.json; do + config_get json_script "$cfg" json_script + for file in $json_script; do [ -s "$file" ] && procd_append_param command -H "$file" done