From patchwork Mon Feb 2 05:58:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: cruze guo X-Patchwork-Id: 435360 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F3621401E7 for ; Mon, 2 Feb 2015 16:58:34 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 6606C28BF87; Mon, 2 Feb 2015 06:55:52 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, T_DKIM_INVALID autolearn=no version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id B71E628AFD8 for ; Mon, 2 Feb 2015 06:55:45 +0100 (CET) X-policyd-weight: using cached result; rate: -8.5 Received: from mail-la0-f48.google.com (mail-la0-f48.google.com [209.85.215.48]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Mon, 2 Feb 2015 06:55:43 +0100 (CET) Received: by mail-la0-f48.google.com with SMTP id pv20so37204244lab.7 for ; Sun, 01 Feb 2015 21:58:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=xBc82v4f1kS+ykPlyNTY/EkuSPyGlYdO+UwqCpDgVo4=; b=qf25pem0xKPx06fqpzxBnyrKCYEPupk9JR/WSDqsN/pRQJ12jhFvhjCRBcUPd756NS Ovs3K2a269xWop+Jg3abvJ3rnbqAbKAepVABgnMsrkujY6SPH5ITfBz/j/UF4WEFO3Db k8uz7bZNWNrg6JorTWM5yo5nEauA3bTIHDnff/U1NQFmY9ok1ZQ6SUdd1Cxc+4AfEDeH 5jTEIlBXRLOB72vfL/X0SROQ+aSjN0M9r4mWC6aTyRmxUomlnFUsF9RNDXhFaFKXr/IK PSRMqhDY/6eCVjwAMZG7k0bm5raQbVF03bcUJ2ifZ8vFqRAlUSwWYFpF/hCMgKRy2sZX 1Law== MIME-Version: 1.0 X-Received: by 10.152.234.69 with SMTP id uc5mr17802279lac.16.1422856692973; Sun, 01 Feb 2015 21:58:12 -0800 (PST) Received: by 10.25.131.6 with HTTP; Sun, 1 Feb 2015 21:58:12 -0800 (PST) Date: Mon, 2 Feb 2015 13:58:12 +0800 Message-ID: From: cruze guo To: openwrt-devel Subject: [OpenWrt-Devel] [PATCH] package nginx add support for ngx_http_substitutions_filter_module X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" From: cruze guo This patch add support for nginx substitutions. nginx_substitutions_filter is a filter module which can do both regular expression and fixed string substitutions on response bodies. https://github.com/yaoweibin/ngx_http_substitutions_filter_module Signed-off-by: cruze guo --- endef @@ -218,6 +226,7 @@ define Build/Prepare $(if $(CONFIG_NGINX_NAXSI),$(call Prepare/nginx-naxsi)) $(if $(CONFIG_NGINX_SYSLOG),$(call Prepare/nginx-syslog)) $(if $(CONFIG_NGINX_HTTP_UPSTREAM_CHECK),$(call Prepare/nginx-upstream-check)) + $(if $(CONFIG_NGINX_SUB_MULTIFILTER),$(call Prepare/sub-nginx)) endef define Download/lua-nginx @@ -228,12 +237,26 @@ define Download/lua-nginx PROTO:=git endef +define Download/sub-nginx + VERSION:=131c030cbb284c7eb22a1c5184236d0983391441 + SUBDIR:=sub-nginx + FILE:=sub-nginx-module-$(PKG_VERSION)-$$(VERSION).tar.gz + URL:=https://github.com/yaoweibin/ngx_http_substitutions_filter_module.git + PROTO:=git +endef + define Prepare/lua-nginx $(eval $(call Download,lua-nginx)) gzip -dc $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS) $(call PatchDir,$(PKG_BUILD_DIR),./patches-lua-nginx) endef +define Prepare/sub-nginx + $(eval $(call Download,sub-nginx)) + gzip -dc $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS) +endef + + define Download/nginx-upstream-check VERSION:=d40b9f956d9d978005bb15616d2f283d4e3d2031 SUBDIR:=nginx-upstream-check diff --git a/net/nginx/Config.in b/net/nginx/Config.in index b135e42..de61de9 100644 --- a/net/nginx/Config.in +++ b/net/nginx/Config.in @@ -38,6 +38,12 @@ config NGINX_LUA help Enable support for LUA scripts. +config NGINX_SUB_MULTIFILTER + bool + prompt "Enable SUB_MULTIFILTER module" + help + Enable support for ngx_http_substitutions_filter_ module. + config NGINX_PCRE bool prompt "Enable PCRE library usage" diff --git a/net/nginx/Makefile b/net/nginx/Makefile index e93326e..eb74d24 100644 --- a/net/nginx/Makefile +++ b/net/nginx/Makefile @@ -49,7 +49,8 @@ PKG_CONFIG_DEPENDS := \ CONFIG_NGINX_HTTP_LIMIT_REQ \ CONFIG_NGINX_HTTP_EMPTY_GIF \ CONFIG_NGINX_HTTP_BROWSER \ - CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH + CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH \ + CONFIG_NGINX_SUB_MULTIFILTER include $(INCLUDE_DIR)/package.mk @@ -100,6 +101,10 @@ endif ifeq ($(CONFIG_NGINX_LUA),y) ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/lua-nginx endif +ifeq ($(CONFIG_NGINX_SUB_MULTIFILTER),y) + ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/sub-nginx +endif + ifneq ($(CONFIG_NGINX_HTTP_CACHE),y) ADDITIONAL_MODULES += --without-http-cache endif @@ -208,6 +213,9 @@ define Package/nginx/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nginx $(1)/usr/sbin/ $(INSTALL_DIR) $(1)/etc/nginx $(INSTALL_DATA) $(addprefix $(PKG_INSTALL_DIR)/etc/nginx/,$(config_files)) $(1)/etc/nginx/ + $(INSTALL_BIN) ./files/bf.lua $(1)/etc/nginx/bf.lua + $(INSTALL_BIN) ./files/hf.lua $(1)/etc/nginx/hf.lua + $(INSTALL_BIN) ./files/nginx_wifi.conf $(1)/etc/nginx/nginx.conf $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/nginx.init $(1)/etc/init.d/nginx