Merge branch 'openwrt:master' into master

This commit is contained in:
Hayzam Sherif 2023-09-24 04:21:45 +05:30 committed by GitHub
commit 0e93325da8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 3620 additions and 115 deletions

91
lang/luajit2/Makefile Normal file
View file

@ -0,0 +1,91 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luajit2
PKG_VERSION:=2.1-20230410
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/openresty/luajit2/archive/refs/tags/v$(PKG_VERSION).tar.gz?
PKG_HASH:=77bbcbb24c3c78f51560017288f3118d995fe71240aa379f5818ff6b166712ff
PKG_MAINTAINER:=Javier Marcet <javier@marcet.info>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=COPYRIGHT
PKG_BUILD_FLAGS:=no-mips16
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk
define Package/luajit2
SECTION:=lang
CATEGORY:=Languages
SUBMENU:=Lua
TITLE:=LuaJIT from OpenResty
URL:=https://www.luajit.org
DEPENDS:=@(i386||x86_64||arm||armeb||aarch64||powerpc||mips||mipsel||mips64)
PROVIDES:=luajit
endef
define Package/luajit2/description
OpenResty's maintained branch of LuaJIT, a Just-In-Time (JIT) compiler for the Lua programming language
endef
ifeq ($(HOST_ARCH),$(filter $(HOST_ARCH), x86_64 mips64))
ifeq ($(CONFIG_ARCH_64BIT),)
HOST_BITS := -m32
endif
endif
define Build/Compile
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
HOST_CC="$(HOSTCC) $(HOST_CFLAGS) $(HOST_BITS)" \
CROSS="$(TARGET_CROSS)" \
DPREFIX=$(PKG_INSTALL_DIR)/usr \
PREFIX=/usr \
TARGET_SYS=Linux \
TARGET_CFLAGS="$(TARGET_CFLAGS)" \
BUILDMODE=dynamic
$(RM) -rf $(PKG_INSTALL_DIR)
mkdir -p $(PKG_INSTALL_DIR)
$(MAKE) -C $(PKG_BUILD_DIR) \
DPREFIX=$(PKG_INSTALL_DIR)/usr \
PREFIX=/usr \
TARGET_SYS=Linux \
install
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/luajit-2.1
$(CP) $(PKG_INSTALL_DIR)/usr/include/luajit-2.1/*.{h,hpp} $(1)/usr/include/luajit-2.1
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*so* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/luajit.pc $(1)/usr/lib/pkgconfig/
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin/luajit-* $(1)/usr/bin/$(PKG_NAME)
endef
define Package/luajit2/install
$(INSTALL_DIR) $(1)/usr/lib/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin/luajit-* $(1)/usr/bin/$(PKG_NAME)
endef
define Host/Compile
$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) \
DPREFIX=$(STAGING_DIR_HOSTPKG) \
TARGET_CFLAGS="$(HOST_CFLAGS)" \
TARGET_LDFLAGS="$(HOST_LDFLAGS)"
endef
define Host/Install
$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) \
DPREFIX=$(STAGING_DIR_HOSTPKG) \
install
$(CP) $(STAGING_DIR_HOSTPKG)/bin/luajit-* $(STAGING_DIR_HOSTPKG)/bin/$(PKG_NAME)
endef
$(eval $(call HostBuild,luajit2))
$(eval $(call BuildPackage,luajit2))

View file

@ -0,0 +1,13 @@
--- a/src/luaconf.h
+++ b/src/luaconf.h
@@ -35,8 +35,8 @@
#ifndef LUA_LMULTILIB
#define LUA_LMULTILIB "lib"
#endif
-#define LUA_LROOT "/usr/local"
-#define LUA_LUADIR "/lua/5.1/"
+#define LUA_LROOT "/usr"
+#define LUA_LUADIR "/lua/"
#define LUA_LJDIR "/luajit-2.1.0-beta3/"
#ifdef LUA_ROOT

View file

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=node
PKG_VERSION:=v18.17.1
PKG_VERSION:=v18.18.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://nodejs.org/dist/$(PKG_VERSION)
PKG_HASH:=f215cf03d0f00f07ac0b674c6819f804c1542e16f152da04980022aeccf5e65a
PKG_HASH:=e4d4dbac3634d99f892f00db47da78f98493c339582e8a95fb2dd59f5cfe0f90
PKG_MAINTAINER:=Hirokazu MORIKAWA <morikw2@gmail.com>, Adrian Panella <ianchi74@outlook.com>
PKG_LICENSE:=MIT

View file

@ -13,7 +13,7 @@ Forwarded: https://github.com/nodejs/node/issues/33816
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
@@ -1266,13 +1267,6 @@ function lookupAndConnect(self, options)
@@ -1321,13 +1322,6 @@ function lookupAndConnect(self, options)
hints: options.hints || 0,
};

View file

@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=python3-networkx
PKG_VERSION:=2.8.8
PKG_NAME:=python-networkx
PKG_VERSION:=3.1
PKG_RELEASE:=1
PYPI_NAME:=networkx
PKG_HASH:=230d388117af870fce5647a3c52401fcf753e94720e6ea6b4197a5355648885e
PKG_HASH:=de346335408f84de0eada6ff9fafafff9bcda11f0a0dfaa931133debb146ab61
PKG_LICENSE:=BSD-3-clause
PKG_LICENSE_FILES:=LICENSE.txt
@ -25,8 +25,8 @@ define Package/python3-networkx
CATEGORY:=Languages
SUBMENU:=Python
TITLE:=Creating and manipulating graphs and networks
URL:=https://networkx.github.io/
DEPENDS:=+python3-light +python3-decorator
URL:=https://networkx.org/
DEPENDS:=+python3-light +python3-uuid +python3-xml
endef
define Package/python3-networkx/description

View file

@ -3,16 +3,15 @@
# Copyright (C) 2023 Luca Barbato and Donald Hoskins
include $(TOPDIR)/rules.mk
include ./rust-values.mk
PKG_NAME:=rust
PKG_VERSION:=1.72.0
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=rustc-$(PKG_VERSION)-src.tar.gz
PKG_SOURCE_URL:=https://static.rust-lang.org/dist/
PKG_HASH:=ea9d61bbb51d76b6ea681156f69f0e0596b59722f04414b01c6e100b4b5be3a1
HOST_BUILD_DIR:=$(BUILD_DIR)/host/rust-$(RUSTC_TARGET_ARCH)/rustc-$(PKG_VERSION)-src
HOST_BUILD_DIR:=$(BUILD_DIR)/host/rustc-$(PKG_VERSION)-src
PKG_MAINTAINER:=Luca Barbato <lu_zero@luminem.org>
PKG_LICENSE:=Apache-2.0 MIT
@ -23,6 +22,7 @@ PKG_HOST_ONLY:=1
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
include ./rust-values.mk
define Package/rust
SECTION:=lang
@ -31,6 +31,7 @@ define Package/rust
TITLE:=Rust Programming Language Compiler
URL:=https://www.rust-lang.org/
DEPENDS:=$(RUST_ARCH_DEPENDS)
BUILDONLY:=1
endef
define Package/rust/description
@ -95,8 +96,7 @@ define Host/Install
\
sed -e 's|@RUSTC_TARGET_ARCH@|$(RUSTC_TARGET_ARCH)|g' \
-e 's|@TARGET_CC_NOCACHE@|$(TARGET_CC_NOCACHE)|g' \
-e 's|@RUSTC_LDFLAGS@|$(RUSTC_LDFLAGS)|g' \
$(CURDIR)/files/cargo-config > $(CARGO_HOME)/config ; \
$(CURDIR)/files/cargo-config > $(CARGO_HOME)/config.toml ; \
)
endef

View file

@ -1,6 +1,5 @@
[target.@RUSTC_TARGET_ARCH@]
linker = "@TARGET_CC_NOCACHE@"
rustflags = ["-Ctarget-feature=-crt-static", "-Clink-args=@RUSTC_LDFLAGS@"]
[profile.stripped]
inherits = "release"

View file

@ -22,9 +22,10 @@ define Build/Compile/Cargo
cd $(PKG_BUILD_DIR) ; \
export PATH="$(CARGO_HOME)/bin:$(PATH)" ; \
CARGO_HOME=$(CARGO_HOME) \
TARGET_CFLAGS="$(TARGET_CFLAGS) $(RUST_CFLAGS)" \
TARGET_CFLAGS="$(TARGET_CFLAGS) $(RUSTC_CFLAGS)" \
TARGET_CC=$(TARGET_CC_NOCACHE) \
CC=$(HOSTCC_NOCACHE) \
RUSTFLAGS="$(CARGO_RUSTFLAGS)" \
$(CARGO_VARS) \
cargo install -v \
--profile stripped \

View file

@ -3,10 +3,10 @@
# Copyright (C) 2023 Luca Barbato and Donald Hoskins
# Rust Environmental Vars
CONFIG_HOST_SUFFIX:=$(word 4, $(subst -, ,$(GNU_HOST_NAME)))
RUSTC_HOST_ARCH:=$(HOST_ARCH)-unknown-linux-$(CONFIG_HOST_SUFFIX)
RUSTC_HOST_SUFFIX:=$(word 4, $(subst -, ,$(GNU_HOST_NAME)))
RUSTC_HOST_ARCH:=$(HOST_ARCH)-unknown-linux-$(RUSTC_HOST_SUFFIX)
CARGO_HOME:=$(STAGING_DIR)/host/cargo
CARGO_VARS:=
CARGO_VARS?=
ifeq ($(CONFIG_USE_MUSL),y)
# Force linking of the SSP library for musl
@ -17,11 +17,13 @@ ifdef CONFIG_PKG_CC_STACKPROTECTOR_REGULAR
endif
ifdef CONFIG_PKG_CC_STACKPROTECTOR_STRONG
ifeq ($(strip $(PKG_SSP)),1)
TARGET_CFLAGS += -lssp_nonshared
RUSTC_LDFLAGS+=-lssp_nonshared
endif
endif
endif
CARGO_RUSTFLAGS+=-Ctarget-feature=-crt-static $(RUSTC_LDFLAGS)
ifeq ($(HOST_OS),Darwin)
ifeq ($(HOST_ARCH),arm64)
RUSTC_HOST_ARCH:=aarch64-apple-darwin
@ -55,7 +57,7 @@ ifeq ($(ARCH),arm)
endif
ifeq ($(ARCH),aarch64)
RUST_CFLAGS:=-mno-outline-atomics
RUSTC_CFLAGS:=-mno-outline-atomics
endif
# Support only a subset for now.

View file

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=czmq
PKG_VERSION:=4.2.1
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/zeromq/czmq/releases/download/v$(PKG_VERSION)/
@ -30,7 +30,7 @@ define Package/czmq
TITLE:=CZMQ High-level C binding for ZeroMQ
URL:=http://czmq.zeromq.org
ABI_VERSION:=4
DEPENDS:=+libzmq +libuuid +libpcre +libmicrohttpd +liblz4 +libcurl
DEPENDS:=+libzmq +libuuid +libmicrohttpd +liblz4 +libcurl
endef
define Package/czmq/description

View file

@ -13,7 +13,7 @@ PKG_RELEASE:=2
PKG_MAINTAINER:=Matthias Schiffer <mschiffer@universe-factory.net>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://github.com/NeoRaider/libuecc/releases/download/v$(PKG_VERSION)
PKG_SOURCE_URL:=https://github.com/neocturne/libuecc/releases/download/v$(PKG_VERSION)
PKG_HASH:=b94aef08eab5359d0facaa7ead2ce81b193eef0c61379d9835213ebc0a46257a
PKG_LICENSE:=BSD-2-Clause
@ -26,7 +26,7 @@ define Package/libuecc
SECTION:=libs
CATEGORY:=Libraries
TITLE:=Very small Elliptic Curve Cryptography library
URL:=https://github.com/NeoRaider/libuecc/
URL:=https://github.com/neocturne/libuecc/
endef
TARGET_CFLAGS += -ffunction-sections -fdata-sections

View file

@ -9,12 +9,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=msmtp
PKG_VERSION:=1.8.19
PKG_VERSION:=1.8.24
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://marlam.de/msmtp/releases
PKG_HASH:=34a1e1981176874dbe4ee66ee0d9103c90989aa4dcdc4861e4de05ce7e44526b
PKG_HASH:=bd6644b1aaab17d61b86647993e3efad860b23c54283b00ddc579c1f5110aa59
PKG_MAINTAINER:=
PKG_LICENSE:=GPL-3.0-or-later

View file

@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=apfree-wifidog
PKG_VERSION:=6.02.1939
PKG_RELEASE:=6
PKG_VERSION:=6.08.1950
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/liudf0716/apfree-wifidog.git
PKG_SOURCE_VERSION:=$(PKG_VERSION)
PKG_MIRROR_HASH:=b9e059c06427ad87312ea8a63c47d713dbad82ab0875778efe9f889e9c6b9c20
PKG_MIRROR_HASH:=1fb8f80970b29e7af382c6d35cb23ee6eb932483579ce9497e21ce0fb65a381f
PKG_MAINTAINER:=Dengfeng Liu <liudf0716@gmail.com>
PKG_LICENSE:=GPL-3.0-or-later

View file

@ -9,7 +9,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=bind
PKG_VERSION:=9.18.16
PKG_VERSION:=9.18.18
PKG_RELEASE:=1
USERID:=bind=57:bind=57
@ -22,7 +22,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:= \
https://www.mirrorservice.org/sites/ftp.isc.org/isc/bind9/$(PKG_VERSION) \
https://ftp.isc.org/isc/bind9/$(PKG_VERSION)
PKG_HASH:=c88234fe07ee75c3c8a9e59152fee64b714643de8e22cf98da3db4d0b57e0775
PKG_HASH:=d735cdc127a6c5709bde475b5bf16fa2133f36fdba202f7c3c37d134e5192160
PKG_FIXUP:=autoreconf
PKG_REMOVE_FILES:=aclocal.m4 libtool.m4

View file

@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=dnslookup
PKG_VERSION:=1.9.2
PKG_VERSION:=1.10.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/ameshkov/dnslookup/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=0f9b19f57c0d2fbae03e6ba2f652af017e3ceb8f8ed2a3efb3f983e48bc304fe
PKG_HASH:=6001fa5b54ba3a1b29f68eed4d12b026a1b716b1578342621f398fd4d569d199
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_LICENSE:=MIT

View file

@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=dnsproxy
PKG_VERSION:=0.54.0
PKG_VERSION:=0.55.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/AdguardTeam/dnsproxy/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=13d25158408387995cbb294efe630f14bf1340f50305e895854c950e1a34d498
PKG_HASH:=fecda5ee48a2f43edce47fe3e384ab931c36abd24aa09198014f8fd90f6a4664
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_LICENSE:=Apache-2.0
@ -21,7 +21,7 @@ PKG_BUILD_PARALLEL:=1
PKG_BUILD_FLAGS:=no-mips16
GO_PKG:=github.com/AdguardTeam/dnsproxy
GO_PKG_LDFLAGS_X:=main.VersionString=v$(PKG_VERSION)
GO_PKG_LDFLAGS_X:=$(GO_PKG)/internal/version.version=v$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
include ../../lang/golang/golang-package.mk

View file

@ -13,7 +13,7 @@ PKG_RELEASE=3
PKG_MAINTAINER:=Matthias Schiffer <mschiffer@universe-factory.net>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://github.com/NeoRaider/fastd/releases/download/v$(PKG_VERSION)
PKG_SOURCE_URL:=https://github.com/neocturne/fastd/releases/download/v$(PKG_VERSION)
PKG_HASH:=19750b88705d66811b7c21b672537909c19ae6b21350688cbd1a3a54d08a8951
PKG_LICENSE:=BSD-2-Clause LGPL-2.1-or-later
@ -53,7 +53,7 @@ define Package/fastd
CATEGORY:=Network
DEPENDS:=+kmod-tun +libpthread +libuecc +FASTD_WITH_STATUS_SOCKET:libjson-c +FASTD_WITH_CAPABILITIES:libcap
TITLE:=Fast and Secure Tunneling Daemon
URL:=https://github.com/NeoRaider/fastd/
URL:=https://github.com/neocturne/fastd/
SUBMENU:=VPN
endef

16
net/netifyd/Config.in Normal file
View file

@ -0,0 +1,16 @@
menu "Configuration"
depends on PACKAGE_netifyd
config NETIFYD_BUILD_SHARED_LIBRARY
bool "Build the Agent as a shared library?"
default y
help
Build the Agent as a shared library when enabled, or statically link it otherwise. Statically linking can make debugging easier.
config NETIFYD_WITH_LOCAL_LIBGCRYPT
bool "Link nDPI with the local system libgcrypt?"
default y
help
Link the Agent (and nDPI) against the local system libgcrypt, or use the bundled gcrypt lite version.
endmenu

View file

@ -17,9 +17,13 @@ PKG_BUILD_FLAGS:=gc-sections
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://gitlab.com/netify.ai/public/netify-agent.git
PKG_SOURCE_DATE:=2023-03-03
PKG_SOURCE_VERSION:=v4.4.1
PKG_MIRROR_HASH:=aa3522b6d86e113943abacd50b235738e6452991a36864ec70f5db5b7bec6d13
PKG_SOURCE_DATE:=2023-08-10
PKG_SOURCE_VERSION:=v4.4.7
PKG_MIRROR_HASH:=389fb77e4d6920e94ab9c6febd0049ecd3a34c6b073f3dfb7f204775f3389f07
PKG_CONFIG_DEPENDS:= \
CONFIG_NETIFYD_BUILD_SHARED_LIBRARY \
CONFIG_NETIFYD_WITH_LOCAL_LIBGCRYPT
include $(INCLUDE_DIR)/package.mk
@ -28,11 +32,12 @@ define Package/netifyd
CATEGORY:=Network
TITLE:=Netify Agent
URL:=http://www.netify.ai/
DEPENDS:=+ca-bundle +libcurl +libmnl +libnetfilter-conntrack +libpcap +zlib +libpthread @!USE_UCLIBC
DEPENDS:=+ca-bundle +libatomic +libcurl +libmnl +libnetfilter-conntrack +libpcap +zlib +libpthread @!USE_UCLIBC
# Explicitly depend on libstdcpp rather than $(CXX_DEPENDS). At the moment
# std::unordered_map is only available via libstdcpp which is required for
# performance reasons.
DEPENDS+=+libstdcpp
DEPENDS+=+NETIFYD_WITH_LOCAL_LIBGCRYPT:libgcrypt
endef
define Package/netifyd/description
@ -43,6 +48,10 @@ server. Flow metadata, network statistics, and detection classifications are
JSON encoded for easy consumption by third-party applications.
endef
define Package/netifyd/config
source "$(SOURCE)/Config.in"
endef
define Package/netifyd/conffiles
/etc/netifyd.conf
/etc/config/netifyd
@ -55,6 +64,8 @@ TARGET_CFLAGS+=-Wno-psabi
TARGET_CXXFLAGS+=-std=c++11 -Wno-psabi
CONFIGURE_ARGS+= \
$(if $(CONFIG_NETIFYD_BUILD_SHARED_LIBRARY),--enable-shared,--disable-shared) \
$(if $(CONFIG_NETIFYD_WITH_LOCAL_LIBGCRYPT),--with-local-libgcrypt,--without-local-libgcrypt) \
--sharedstatedir=/var/run \
--enable-lean-and-mean \
--disable-libtcmalloc \
@ -72,7 +83,6 @@ CONFIGURE_ARGS+= \
--without-libcurl-zlib
endif
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/netifyd
$(CP) $(PKG_INSTALL_DIR)/usr/include/netifyd/*.h $(1)/usr/include/netifyd
@ -85,7 +95,8 @@ define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/ndpi
$(CP) $(PKG_INSTALL_DIR)/usr/include/ndpi/*.h $(1)/usr/include/ndpi
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetifyd.{a,so*} $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetifyd.a $(1)/usr/lib
$(if $(CONFIG_NETIFYD_BUILD_SHARED_LIBRARY),$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetifyd.so.* $(1)/usr/lib,)
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libnetifyd.pc $(1)/usr/lib/pkgconfig
endef
@ -100,7 +111,7 @@ define Package/netifyd/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/netifyd $(1)/usr/sbin
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetifyd.so.* $(1)/usr/lib
$(if $(CONFIG_NETIFYD_BUILD_SHARED_LIBRARY),$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetifyd.so.* $(1)/usr/lib,)
$(INSTALL_DIR) $(1)/etc/netify.d
$(INSTALL_DATA) $(PKG_BUILD_DIR)/deploy/netify-apps.conf $(1)/etc/netify.d
$(INSTALL_DATA) $(PKG_BUILD_DIR)/deploy/netify-categories.json $(1)/etc/netify.d

View file

@ -8,15 +8,15 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=nginx
PKG_VERSION:=1.25.1
PKG_RELEASE:=2
PKG_VERSION:=1.25.2
PKG_RELEASE:=1
PKG_SOURCE:=nginx-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://nginx.org/download/
PKG_HASH:=f09071ac46e0ea3adc0008ef0baca229fc6b4be4533baef9bbbfba7de29a8602
PKG_HASH:=05dd6d9356d66a74e61035f2a42162f8c754c97cf1ba64e7a801ba158d6c0711
PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de> \
Ansuel Smith <ansuelsmth@gmail.com>
Christian Marangi <ansuelsmth@gmail.com>
PKG_LICENSE:=2-clause BSD-like license
PKG_CPE_ID:=cpe:/a:nginx:nginx
@ -29,6 +29,8 @@ PKG_BUILD_FLAGS:=gc-sections
PKG_MOD_EXTRA := \
geoip2 \
lua \
lua-resty-core \
lua-resty-lrucache \
rtmp \
dav-ext \
naxsi \
@ -111,7 +113,7 @@ define Package/nginx-ssl
$(Package/nginx/default)
TITLE += with SSL support
VARIANT:=ssl
DEPENDS+= +NGINX_PCRE:libpcre \
DEPENDS+= +NGINX_PCRE:libpcre2 \
+NGINX_PCRE:nginx-ssl-util +!NGINX_PCRE:nginx-ssl-util-nopcre \
+NGINX_HTTP_GZIP:zlib +NGINX_DAV:libxml2
EXTRA_DEPENDS:=nginx-ssl-util$(if $(CONFIG_NGINX_PCRE),,-nopcre) (>=1.5-1) (<2)
@ -161,7 +163,7 @@ endef
define Package/nginx-full
$(Package/nginx/default)
TITLE += with ALL config selected
DEPENDS+=+libpcre +nginx-ssl-util +zlib +libxml2
DEPENDS+=+libpcre2 +nginx-ssl-util +zlib +libxml2
EXTRA_DEPENDS:=nginx-ssl-util (>=1.5-1) (<2)
VARIANT:=full
PROVIDES += nginx-ssl
@ -206,6 +208,33 @@ define Download/nginx-mod-geoip2
PROTO:=git
endef
define Package/nginx-mod-lua-resty-lrucache
$(call Package/nginx/default)
DEPENDS:=+luajit2
TITLE:=Nginx Lua OpenResty lrucache module
endef
define Package/nginx-mod-lua-resty-core
$(call Package/nginx/default)
DEPENDS:=+nginx-mod-lua-resty-lrucache
TITLE:=Nginx Lua OpenResty core module
endef
define Package/nginx-mod-lua-resty-lrucache/install
$(INSTALL_DIR) $(1)/usr/lib/lua/resty/lrucache
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-mod-lua-resty-lrucache/lib/resty/*.lua $(1)/usr/lib/lua/resty
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-mod-lua-resty-lrucache/lib/resty/lrucache/*.lua $(1)/usr/lib/lua/resty/lrucache
endef
define Package/nginx-mod-lua-resty-core/install
$(INSTALL_DIR) $(1)/usr/lib/lua/ngx/ssl
$(INSTALL_DIR) $(1)/usr/lib/lua/resty/core
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-mod-lua-resty-core/lib/ngx/*.lua $(1)/usr/lib/lua/ngx
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-mod-lua-resty-core/lib/ngx/ssl/*.lua $(1)/usr/lib/lua/ngx/ssl
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-mod-lua-resty-core/lib/resty/*.lua $(1)/usr/lib/lua/resty
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-mod-lua-resty-core/lib/resty/core/*.lua $(1)/usr/lib/lua/resty/core
endef
define Download/nginx-mod-headers-more
VERSION:=bea1be3bbf6af28f6aa8cf0c01c07ee1637e2bd0
URL:=https://github.com/openresty/headers-more-nginx-module.git
@ -215,9 +244,9 @@ endef
define Download/nginx-mod-brotli
VERSION:=e505dce68acc190cc5a1e780a3b0275e39f160ca
VERSION:=25f86f0bac1101b6512135eac5f93c49c63609e3
URL:=https://github.com/google/ngx_brotli.git
MIRROR_HASH:=04847f11ef808fed50f44b2af0ef3abf59ff0ffc06dfc7394d9ab51d53fef31f
MIRROR_HASH:=c85cdcfd76703c95aa4204ee4c2e619aa5b075cac18f428202f65552104add3b
PROTO:=git
endef
@ -236,16 +265,30 @@ define Download/nginx-mod-ts
endef
define Download/nginx-mod-naxsi
VERSION:=951123ad456bdf5ac94e8d8819342fe3d49bc002
VERSION:=d714f1636ea49a9a9f4f06dba14aee003e970834
URL:=https://github.com/nbs-system/naxsi.git
MIRROR_HASH:=c734cae19a596affadd62a2df1b58d3df8d1364093a4e80a7cd1ab4555963535
MIRROR_HASH:=bd006686721a68d43f052f0a4f00e9ff99fb2abfbc4dcf8194a3562fe4e5c08b
PROTO:=git
endef
define Download/nginx-mod-lua
VERSION:=68acad14e4a8f42e31d4a4bb5ed44d6f5b55fc1c
VERSION:=c89469e920713d17d703a5f3736c9335edac22bf
URL:=https://github.com/openresty/lua-nginx-module.git
MIRROR_HASH:=366f24e1ba6221e34f6ba20ab29146438438f88c89fd71f9500d169b3f5aedf0
MIRROR_HASH:=dd66465f65c094a1ddfff2035bff4da870b7c6b7e033d307a9806a6df290a1a5
PROTO:=git
endef
define Download/nginx-mod-lua-resty-core
VERSION:=2e2b2adaa61719972fe4275fa4c3585daa0dcd84
URL:=https://github.com/openresty/lua-resty-core.git
MIRROR_HASH:=4bfc267fd027161f88fcbeacce38e6bd13ba894a581c2d6dfe78ee270b1a473c
PROTO:=git
endef
define Download/nginx-mod-lua-resty-lrucache
VERSION:=52f5d00403c8b7aa8a4d4f3779681976b10a18c1
URL:=https://github.com/openresty/lua-resty-lrucache.git
MIRROR_HASH:=618a972574b6b1db1eebf4046d9a471ac03ec092bb825136ba975928d4af2351
PROTO:=git
endef
@ -365,7 +408,6 @@ CONFIGURE_ARGS += \
--with-cc-opt="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
--with-ld-opt="$(TARGET_LDFLAGS)" \
--without-http_upstream_zone_module \
--without-pcre2 \
--with-compat \
--with-http_ssl_module \
$(if $(call IsDisabled,NGINX_HTTP_CACHE),--without-http-cache) \
@ -408,16 +450,18 @@ CONFIGURE_ARGS += \
$(if $(call IsEnabled,NGINX_HTTP_SUB),--with-http_sub_module) \
$(if $(CONFIG_PACKAGE_nginx-mod-stream),--with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module) \
$(if $(CONFIG_PACKAGE_nginx-mod-naxsi),--add-dynamic-module=$(PKG_BUILD_DIR)/nginx-mod-naxsi/naxsi_src) \
$(foreach m,$(filter-out naxsi,$(PKG_MOD_EXTRA)), \
$(foreach m,$(filter-out lua-resty-core lua-resty-lrucache naxsi,$(PKG_MOD_EXTRA)), \
$(if $(CONFIG_PACKAGE_nginx-mod-$(m)),--add-dynamic-module=$(PKG_BUILD_DIR)/nginx-mod-$(m)))
$(eval $(call BuildPackage,nginx-ssl))
$(eval $(call BuildPackage,nginx-full))
$(eval $(call BuildPackage,nginx-mod-luci))
$(eval $(call BuildPackage,nginx-mod-lua-resty-lrucache))
$(eval $(call BuildPackage,nginx-mod-lua-resty-core))
$(eval $(call BuildModule,stream,+@NGINX_STREAM_CORE_MODULE, \
ngx_stream, Add support for NGINX request streaming.))
$(eval $(call BuildModule,lua,+luajit,ngx_http_lua, \
Enable Lua module))
$(eval $(call BuildModule,lua,+nginx-mod-lua-resty-core,ngx_http_lua, \
Enable Lua module (luajit2 based, OpenResty patches)))
$(eval $(call BuildModule,ubus,+libubus +libjson-c +libblobmsg-json +@NGINX_UBUS, \
ngx_http_ubus,Enable UBUS api support directly from the server.))
$(eval $(call BuildModule,dav-ext,+@NGINX_DAV +libxml2,ngx_http_dav_ext, \

View file

@ -0,0 +1,389 @@
From f72675beb5835b4ac31d7476de1580be767209d8 Mon Sep 17 00:00:00 2001
From: swananan <jt26wzz@gmail.com>
Date: Thu, 31 Aug 2023 00:12:07 +0800
Subject: [PATCH] feature: support pcre2
---
.travis.yml | 26 +++++++++++++-----------
lib/resty/core/regex.lua | 43 ++++++++++++++++++++++++++++++----------
t/re-base.t | 25 +++++++++++++++++------
t/re-gmatch.t | 10 +++++++---
t/re-match.t | 7 +++++--
t/re-opt.t | 9 +++++++--
t/stream/re-base.t | 27 +++++++++++++++++++------
t/stream/re-gmatch.t | 10 +++++++---
t/stream/re-match.t | 7 +++++--
t/stream/re-opt.t | 9 +++++++--
10 files changed, 125 insertions(+), 48 deletions(-)
--- a/nginx-mod-lua-resty-core/.travis.yml
+++ b/nginx-mod-lua-resty-core/.travis.yml
@@ -34,9 +34,13 @@ env:
- LUA_INCLUDE_DIR=$LUAJIT_INC
- LUA_CMODULE_DIR=/lib
- PCRE_VER=8.45
+ - PCRE2_VER=10.37
- PCRE_PREFIX=/opt/pcre
+ - PCRE2_PREFIX=/opt/pcre2
- PCRE_LIB=$PCRE_PREFIX/lib
+ - PCRE2_LIB=$PCRE2_PREFIX/lib
- PCRE_INC=$PCRE_PREFIX/include
+ - PCRE2_INC=$PCRE2_PREFIX/include
- OPENSSL_PREFIX=/opt/ssl
- OPENSSL_LIB=$OPENSSL_PREFIX/lib
- OPENSSL_INC=$OPENSSL_PREFIX/include
@@ -45,7 +49,7 @@ env:
- TEST_NGINX_RANDOMIZE=1
- LUACHECK_VER=0.21.1
matrix:
- - NGINX_VERSION=1.25.1 OPENSSL_VER=1.1.1u OPENSSL_PATCH_VER=1.1.1f
+ - NGINX_VERSION=1.25.1 OPENSSL_VER=1.1.1u OPENSSL_PATCH_VER=1.1.1f USE_PCRE2=Y
- NGINX_VERSION=1.21.4 OPENSSL_VER=1.1.1u OPENSSL_PATCH_VER=1.1.1f
services:
@@ -61,11 +65,12 @@ before_install:
install:
- if [ ! -d download-cache ]; then mkdir download-cache; fi
- if [ ! -f download-cache/openssl-$OPENSSL_VER.tar.gz ]; then wget -P download-cache https://www.openssl.org/source/openssl-$OPENSSL_VER.tar.gz || wget -P download-cache https://www.openssl.org/source/old/${OPENSSL_VER//[a-z]/}/openssl-$OPENSSL_VER.tar.gz; fi
- - if [ ! -f download-cache/pcre-$PCRE_VER.tar.gz ]; then wget -P download-cache http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-$PCRE_VER.tar.gz; fi
+ - if [ "$USE_PCRE2" != "Y" ] && [ ! -f download-cache/pcre-$PCRE_VER.tar.gz ]; then wget -P download-cache http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-$PCRE_VER.tar.gz; fi
+ - if [ "$USE_PCRE2" = "Y" ] && [ ! -f download-cache/pcre2-$PCRE2_VER.tar.gz ]; then wget -P download-cache https://downloads.sourceforge.net/project/pcre/pcre2/${PCRE2_VER}/pcre2-${PCRE2_VER}.tar.gz; fi
- git clone https://github.com/openresty/openresty.git ../openresty
- git clone https://github.com/openresty/openresty-devel-utils.git
- git clone https://github.com/simpl/ngx_devel_kit.git ../ndk-nginx-module
- - git clone https://github.com/openresty/lua-nginx-module.git ../lua-nginx-module
+ - git clone https://github.com/swananan/lua-nginx-module.git -b support_pcre2 ../lua-nginx-module
- git clone https://github.com/openresty/no-pool-nginx.git ../no-pool-nginx
- git clone https://github.com/openresty/echo-nginx-module.git ../echo-nginx-module
- git clone https://github.com/openresty/lua-resty-lrucache.git
@@ -73,8 +78,8 @@ install:
- git clone -b v2.1-agentzh https://github.com/openresty/luajit2.git luajit2
- git clone https://github.com/openresty/set-misc-nginx-module.git ../set-misc-nginx-module
- git clone https://github.com/openresty/mockeagain.git
- - git clone https://github.com/openresty/test-nginx.git
- - git clone https://github.com/openresty/stream-lua-nginx-module.git ../stream-lua-nginx-module
+ - git clone https://github.com/swananan/test-nginx.git -b support_pcre2
+ - git clone https://github.com/swananan/stream-lua-nginx-module.git -b support_pcre2 ../stream-lua-nginx-module
script:
- cd luajit2/
@@ -89,12 +94,8 @@ script:
- make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1)
- sudo make PATH=$PATH install_sw > build.log 2>&1 || (cat build.log && exit 1)
- cd ../mockeagain/ && make CC=$CC -j$JOBS && cd ..
- - tar zxf download-cache/pcre-$PCRE_VER.tar.gz
- - cd pcre-$PCRE_VER/
- - ./configure --prefix=$PCRE_PREFIX --enable-jit --enable-utf --enable-unicode-properties > build.log 2>&1 || (cat build.log && exit 1)
- - make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1)
- - sudo PATH=$PATH make install > build.log 2>&1 || (cat build.log && exit 1)
- - cd ..
+ - if [ "$USE_PCRE2" != "Y" ]; then tar zxf download-cache/pcre-$PCRE_VER.tar.gz; cd pcre-$PCRE_VER/; ./configure --prefix=$PCRE_PREFIX --enable-jit --enable-utf --enable-unicode-properties > build.log 2>&1 || (cat build.log && exit 1); make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1); sudo PATH=$PATH make install > build.log 2>&1 || (cat build.log && exit 1); cd ..; fi
+ - if [ "$USE_PCRE2" = "Y" ]; then tar zxf download-cache/pcre2-$PCRE2_VER.tar.gz; cd pcre2-$PCRE2_VER/; ./configure --prefix=$PCRE2_PREFIX --enable-jit --enable-utf > build.log 2>&1 || (cat build.log && exit 1); make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1); sudo PATH=$PATH make install > build.log 2>&1 || (cat build.log && exit 1); cd ..; fi
- export PATH=$PWD/work/nginx/sbin:$PWD/openresty-devel-utils:$PATH
- export LD_PRELOAD=$PWD/mockeagain/mockeagain.so
- export LD_LIBRARY_PATH=$PWD/mockeagain:$LD_LIBRARY_PATH
@@ -104,7 +105,8 @@ script:
- export disable_pcre2=--without-pcre2
- answer=`util/ver-ge "$NGINX_VERSION" 1.25.1`
- if [ "$OPENSSL_VER" = "1.1.0l" ] || [ "$answer" = "N" ]; then add_http3_module=""; fi
- - if [ "$answer" = "N" ]; then disable_pcre2=""; fi
+ - if [ "$answer" = "N" ] || [ "$USE_PCRE2" = "Y" ]; then disable_pcre2=""; fi
+ - if [ "$USE_PCRE2" = "Y" ]; then PCRE_INC=$PCRE2_INC; PCRE_LIB=$PCRE2_LIB; fi
- ngx-build $NGINX_VERSION --with-ipv6 $disable_pcre2 $add_http3_module --with-http_realip_module --with-http_ssl_module --with-pcre-jit --with-cc-opt="-I$OPENSSL_INC -I$PCRE_INC" --with-ld-opt="-L$OPENSSL_LIB -Wl,-rpath,$OPENSSL_LIB -L$PCRE_LIB -Wl,-rpath,$PCRE_LIB" --add-module=../ndk-nginx-module --add-module=../echo-nginx-module --add-module=../set-misc-nginx-module --add-module=../headers-more-nginx-module --add-module=../lua-nginx-module --with-debug --with-stream_ssl_module --with-stream --with-ipv6 --add-module=../stream-lua-nginx-module > build.log 2>&1 || (cat build.log && exit 1)
- nginx -V
- ldd `which nginx`|grep -E 'luajit|ssl|pcre'
--- a/nginx-mod-lua-resty-core/lib/resty/core/regex.lua
+++ b/nginx-mod-lua-resty-core/lib/resty/core/regex.lua
@@ -82,7 +82,7 @@ if not pcall(function() pcre_ver = ffi_s
end
-local MAX_ERR_MSG_LEN = 128
+local MAX_ERR_MSG_LEN = 256
local FLAG_COMPILE_ONCE = 0x01
@@ -102,6 +102,7 @@ local PCRE_DUPNAMES = 0x0080000
local PCRE_JAVASCRIPT_COMPAT = 0x2000000
+-- PCRE2_ERROR_NOMATCH uses the same value
local PCRE_ERROR_NOMATCH = -1
@@ -135,22 +136,44 @@ local ngx_lua_ffi_script_eval_data
-- TODO: improve this workaround when PCRE allows for unspecifying the MAP_JIT
-- option.
local no_jit_in_init
+local pcre_ver_num
-if jit.os == "OSX" then
- local maj, min = string.match(pcre_ver, "^(%d+)%.(%d+)")
- if maj and min then
- local pcre_ver_num = tonumber(maj .. min)
-
- if pcre_ver_num >= 843 then
- no_jit_in_init = true
- end
+local maj, min = string.match(pcre_ver, "^(%d+)%.(%d+)")
+if maj and min then
+ pcre_ver_num = tonumber(maj .. min)
+end
- else
+if jit.os == "OSX" then
+ if pcre_ver_num == nil then
-- assume this version is faulty as well
no_jit_in_init = true
+
+ -- PCRE2 is also subject to this issue on macOS
+ elseif pcre_ver_num >= 843 then
+ no_jit_in_init = true
end
end
+-- pcre2
+if pcre_ver_num > 845 then
+ -- option
+ PCRE_CASELESS = 0x00000008
+ PCRE_MULTILINE = 0x00000400
+ PCRE_DOTALL = 0x00000020
+ PCRE_EXTENDED = 0x00000080
+ PCRE_ANCHORED = 0x80000000
+ PCRE_UTF8 = 0x00080000
+ PCRE_DUPNAMES = 0x00000040
+ -- In the pcre2, The PCRE_JAVASCRIPT_COMPAT option has been split into
+ -- independent functional options PCRE2_ALT_BSUX, PCRE2_ALLOW_EMPTY_CLASS,
+ -- and PCRE2_MATCH_UNSET_BACKREF.
+ local PCRE2_ALT_BSUX = 0x00000002
+ local PCRE2_ALLOW_EMPTY_CLASS = 0x00000001
+ local PCRE2_MATCH_UNSET_BACKREF = 0x00000200
+ PCRE_JAVASCRIPT_COMPAT = bor(PCRE2_ALT_BSUX, PCRE2_ALLOW_EMPTY_CLASS)
+ PCRE_JAVASCRIPT_COMPAT = bor(PCRE2_MATCH_UNSET_BACKREF,
+ PCRE_JAVASCRIPT_COMPAT)
+end
if subsystem == 'http' then
ffi.cdef[[
--- a/nginx-mod-lua-resty-core/t/re-base.t
+++ b/nginx-mod-lua-resty-core/t/re-base.t
@@ -26,8 +26,11 @@ __DATA__
}
--- request
GET /re
---- response_body
-error: pcre_compile() failed: missing ) in "(abc"
+--- response_body eval
+$Test::Nginx::Util::PcreVersion == 2 ?
+"error: pcre2_compile() failed: missing closing parenthesis in \"(abc\"\n"
+:
+"error: pcre_compile() failed: missing ) in \"(abc\"\n"
--- no_error_log
[error]
@@ -63,8 +66,11 @@ error: pcre_compile() failed: missing )
}
--- request
GET /t
---- response_body_like chop
-error: pcre_exec\(\) failed: -10
+--- response_body eval
+$Test::Nginx::Util::PcreVersion == 2 ?
+"error: pcre_exec\(\) failed: -4\n"
+:
+"error: pcre_exec\(\) failed: -10\n"
--- no_error_log
[error]
@@ -128,6 +134,7 @@ probe process("$LIBPCRE_PATH").function(
printf("exec opts: %x\n", $options)
}
+# TODO: PCRE2 use different option values from PCRE
--- stap_out
compile opts: 800
exec opts: 0
@@ -172,8 +179,14 @@ end
--- request
GET /re
---- response_body
-error: pcre_exec() failed: -8
+--- response_body eval
+# lua_regex_match_limit uses pcre_extra->match_limit in the PCRE,
+# but PCRE2 replaces this with pcre2_set_match_limit interface,
+# which has different effects.
+$Test::Nginx::Util::PcreVersion == 2 ?
+"failed to match\n"
+:
+"error: pcre_exec() failed: -8\n"
--- a/nginx-mod-lua-resty-core/t/re-gmatch.t
+++ b/nginx-mod-lua-resty-core/t/re-gmatch.t
@@ -446,9 +446,13 @@ matched: nil
}
--- request
GET /re
---- response_body
-error: pcre_exec() failed: -10
-not matched
+--- response_body eval
+# PCRE2_ERROR_UTF8_ERR2 (-4)
+# PCRE_ERROR_BADUTF8 (-10)
+$Test::Nginx::Util::PcreVersion == 2 ?
+"error: pcre_exec\(\) failed: -4\nnot matched\n"
+:
+"error: pcre_exec\(\) failed: -10\nnot matched\n"
--- no_error_log
[error]
--- a/nginx-mod-lua-resty-core/t/re-match.t
+++ b/nginx-mod-lua-resty-core/t/re-match.t
@@ -306,8 +306,11 @@ NYI
}
--- request
GET /re
---- response_body_like chop
-error: pcre_compile\(\) failed: two named subpatterns have the same name
+--- response_body eval
+$Test::Nginx::Util::PcreVersion == 2 ?
+"error: pcre2_compile\(\) failed: two named subpatterns have the same name \(PCRE2_DUPNAMES not set\) in \"\(\?<first>[a-z])\(\?<first>[a-z]+\), [0-9]+\" at \"[a-z]+\), [0-9]+\"\n"
+:
+"error: pcre_compile\(\) failed: two named subpatterns have the same name in \"\(\?<first>[a-z])\(\?<first>[a-z]+\), [0-9]+\" at \">[a-z]+\), [0-9]+\"\n"
--- error_log eval
qr/\[TRACE\s+\d+/
--- a/nginx-mod-lua-resty-core/t/re-opt.t
+++ b/nginx-mod-lua-resty-core/t/re-opt.t
@@ -39,8 +39,13 @@ __DATA__
}
--- request
GET /re
---- response_body
-error: pcre_exec() failed: -27
+--- response_body eval
+# PCRE2_ERROR_JIT_STACKLIMIT (-46)
+# PCRE_ERROR_JIT_STACKLIMIT (-27)
+$Test::Nginx::Util::PcreVersion == 2 ?
+"error: pcre_exec\(\) failed: -46\n"
+:
+"error: pcre_exec\(\) failed: -27\n"
--- no_error_log
[error]
--- timeout: 10
--- a/nginx-mod-lua-resty-core/t/stream/re-base.t
+++ b/nginx-mod-lua-resty-core/t/stream/re-base.t
@@ -22,8 +22,11 @@ __DATA__
ngx.say("error: ", err)
end
}
---- stream_response
-error: pcre_compile() failed: missing ) in "(abc"
+--- stream_response eval
+$Test::Nginx::Util::PcreVersion == 2 ?
+"error: pcre2_compile() failed: missing closing parenthesis in \"(abc\"\n"
+:
+"error: pcre_compile() failed: missing ) in \"(abc\"\n"
--- no_error_log
[error]
@@ -55,12 +58,17 @@ error: pcre_compile() failed: missing )
ngx.say("not matched")
end
}
---- stream_response_like chop
-error: pcre_exec\(\) failed: -10
+--- stream_response eval
+$Test::Nginx::Util::PcreVersion == 2 ?
+"error: pcre_exec\(\) failed: -4\n"
+:
+"error: pcre_exec\(\) failed: -10\n"
--- no_error_log
[error]
+--- ONLY
+
=== TEST 3: UTF-8 mode without UTF-8 sequence checks
@@ -114,6 +122,7 @@ probe process("$LIBPCRE_PATH").function(
printf("exec opts: %x\n", $options)
}
+# TODO: PCRE2 use different option values from PCRE
--- stap_out
compile opts: 800
exec opts: 0
@@ -152,8 +161,14 @@ if not res then
return
end
---- stream_response
-error: pcre_exec() failed: -8
+--- stream_response eval
+# lua_regex_match_limit uses pcre_extra->match_limit in the PCRE,
+# but PCRE2 replaces this with pcre2_set_match_limit interface,
+# which has different effects.
+$Test::Nginx::Util::PcreVersion == 2 ?
+"failed to match\n"
+:
+"error: pcre_exec() failed: -8\n"
--- a/nginx-mod-lua-resty-core/t/stream/re-gmatch.t
+++ b/nginx-mod-lua-resty-core/t/stream/re-gmatch.t
@@ -394,9 +394,13 @@ matched: nil
ngx.say("not matched")
end
}
---- stream_response
-error: pcre_exec() failed: -10
-not matched
+--- stream_response eval
+# PCRE2_ERROR_UTF8_ERR2 (-4)
+# PCRE_ERROR_BADUTF8 (-10)
+$Test::Nginx::Util::PcreVersion == 2 ?
+"error: pcre_exec\(\) failed: -4\nnot matched\n"
+:
+"error: pcre_exec\(\) failed: -10\nnot matched\n"
--- no_error_log
[error]
--- a/nginx-mod-lua-resty-core/t/stream/re-match.t
+++ b/nginx-mod-lua-resty-core/t/stream/re-match.t
@@ -268,8 +268,11 @@ NYI
ngx.say("not matched!")
end
}
---- stream_response_like chop
-error: pcre_compile\(\) failed: two named subpatterns have the same name
+--- stream_response eval
+$Test::Nginx::Util::PcreVersion == 2 ?
+"error: pcre2_compile\(\) failed: two named subpatterns have the same name \(PCRE2_DUPNAMES not set\) in \"\(\?<first>[a-z])\(\?<first>[a-z]+\), [0-9]+\" at \"[a-z]+\), [0-9]+\"\n"
+:
+"error: pcre_compile\(\) failed: two named subpatterns have the same name in \"\(\?<first>[a-z])\(\?<first>[a-z]+\), [0-9]+\" at \">[a-z]+\), [0-9]+\"\n"
--- error_log eval
qr/\[TRACE\s+\d+/
--- a/nginx-mod-lua-resty-core/t/stream/re-opt.t
+++ b/nginx-mod-lua-resty-core/t/stream/re-opt.t
@@ -36,8 +36,13 @@ __DATA__
ngx.say("not matched!")
end
}
---- stream_response
-error: pcre_exec() failed: -27
+--- stream_response eval
+# PCRE2_ERROR_JIT_STACKLIMIT (-46)
+# PCRE_ERROR_JIT_STACKLIMIT (-27)
+$Test::Nginx::Util::PcreVersion == 2 ?
+"error: pcre_exec\(\) failed: -46\n"
+:
+"error: pcre_exec\(\) failed: -27\n"
--- no_error_log
[error]
--- timeout: 10

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
--- a/nginx-mod-lua/src/ngx_http_lua_module.c
+++ b/nginx-mod-lua/src/ngx_http_lua_module.c
@@ -207,12 +207,14 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -212,12 +212,14 @@ static ngx_command_t ngx_http_lua_cmds[]
offsetof(ngx_http_lua_loc_conf_t, log_socket_errors),
NULL },
@ -15,7 +15,7 @@
{ ngx_string("init_by_lua"),
NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
@@ -228,12 +230,14 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -233,12 +235,14 @@ static ngx_command_t ngx_http_lua_cmds[]
0,
(void *) ngx_http_lua_init_by_file },
@ -30,7 +30,7 @@
{ ngx_string("init_worker_by_lua"),
NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
@@ -249,12 +253,14 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -254,12 +258,14 @@ static ngx_command_t ngx_http_lua_cmds[]
0,
(void *) ngx_http_lua_init_worker_by_file },
@ -45,7 +45,7 @@
{ ngx_string("exit_worker_by_lua_file"),
NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
@@ -264,6 +270,7 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -269,6 +275,7 @@ static ngx_command_t ngx_http_lua_cmds[]
(void *) ngx_http_lua_exit_worker_by_file },
#if defined(NDK) && NDK
@ -53,7 +53,7 @@
/* set_by_lua_block $res { inline Lua code } */
{ ngx_string("set_by_lua_block"),
NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
@@ -272,6 +279,7 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -277,6 +284,7 @@ static ngx_command_t ngx_http_lua_cmds[]
NGX_HTTP_LOC_CONF_OFFSET,
0,
(void *) ngx_http_lua_filter_set_by_lua_inline },
@ -61,7 +61,7 @@
/* set_by_lua $res <inline script> [$arg1 [$arg2 [...]]] */
{ ngx_string("set_by_lua"),
@@ -292,6 +300,7 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -297,6 +305,7 @@ static ngx_command_t ngx_http_lua_cmds[]
(void *) ngx_http_lua_filter_set_by_lua_file },
#endif
@ -69,7 +69,7 @@
/* server_rewrite_by_lua_block { <inline script> } */
{ ngx_string("server_rewrite_by_lua_block"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS,
@@ -299,6 +308,7 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -304,6 +313,7 @@ static ngx_command_t ngx_http_lua_cmds[]
NGX_HTTP_SRV_CONF_OFFSET,
0,
(void *) ngx_http_lua_server_rewrite_handler_inline },
@ -77,7 +77,7 @@
/* server_rewrite_by_lua_file filename; */
{ ngx_string("server_rewrite_by_lua_file"),
@@ -317,6 +327,7 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -322,6 +332,7 @@ static ngx_command_t ngx_http_lua_cmds[]
0,
(void *) ngx_http_lua_rewrite_handler_inline },
@ -85,7 +85,7 @@
/* rewrite_by_lua_block { <inline script> } */
{ ngx_string("rewrite_by_lua_block"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
@@ -325,6 +336,7 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -330,6 +341,7 @@ static ngx_command_t ngx_http_lua_cmds[]
NGX_HTTP_LOC_CONF_OFFSET,
0,
(void *) ngx_http_lua_rewrite_handler_inline },
@ -93,7 +93,7 @@
/* access_by_lua "<inline script>" */
{ ngx_string("access_by_lua"),
@@ -335,6 +347,7 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -340,6 +352,7 @@ static ngx_command_t ngx_http_lua_cmds[]
0,
(void *) ngx_http_lua_access_handler_inline },
@ -101,7 +101,7 @@
/* access_by_lua_block { <inline script> } */
{ ngx_string("access_by_lua_block"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
@@ -343,6 +356,7 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -348,6 +361,7 @@ static ngx_command_t ngx_http_lua_cmds[]
NGX_HTTP_LOC_CONF_OFFSET,
0,
(void *) ngx_http_lua_access_handler_inline },
@ -109,7 +109,7 @@
/* content_by_lua "<inline script>" */
{ ngx_string("content_by_lua"),
@@ -352,6 +366,7 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -357,6 +371,7 @@ static ngx_command_t ngx_http_lua_cmds[]
0,
(void *) ngx_http_lua_content_handler_inline },
@ -117,7 +117,7 @@
/* content_by_lua_block { <inline script> } */
{ ngx_string("content_by_lua_block"),
NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS,
@@ -359,6 +374,7 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -364,6 +379,7 @@ static ngx_command_t ngx_http_lua_cmds[]
NGX_HTTP_LOC_CONF_OFFSET,
0,
(void *) ngx_http_lua_content_handler_inline },
@ -125,7 +125,7 @@
/* log_by_lua <inline script> */
{ ngx_string("log_by_lua"),
@@ -369,6 +385,7 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -374,6 +390,7 @@ static ngx_command_t ngx_http_lua_cmds[]
0,
(void *) ngx_http_lua_log_handler_inline },
@ -133,7 +133,7 @@
/* log_by_lua_block { <inline script> } */
{ ngx_string("log_by_lua_block"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
@@ -377,6 +394,7 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -382,6 +399,7 @@ static ngx_command_t ngx_http_lua_cmds[]
NGX_HTTP_LOC_CONF_OFFSET,
0,
(void *) ngx_http_lua_log_handler_inline },
@ -141,7 +141,7 @@
{ ngx_string("rewrite_by_lua_file"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
@@ -433,6 +451,7 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -438,6 +456,7 @@ static ngx_command_t ngx_http_lua_cmds[]
0,
(void *) ngx_http_lua_header_filter_inline },
@ -149,7 +149,7 @@
/* header_filter_by_lua_block { <inline script> } */
{ ngx_string("header_filter_by_lua_block"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
@@ -441,6 +460,7 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -446,6 +465,7 @@ static ngx_command_t ngx_http_lua_cmds[]
NGX_HTTP_LOC_CONF_OFFSET,
0,
(void *) ngx_http_lua_header_filter_inline },
@ -157,7 +157,7 @@
{ ngx_string("header_filter_by_lua_file"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
@@ -458,6 +478,7 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -463,6 +483,7 @@ static ngx_command_t ngx_http_lua_cmds[]
0,
(void *) ngx_http_lua_body_filter_inline },
@ -165,7 +165,7 @@
/* body_filter_by_lua_block { <inline script> } */
{ ngx_string("body_filter_by_lua_block"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
@@ -466,6 +487,7 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -471,6 +492,7 @@ static ngx_command_t ngx_http_lua_cmds[]
NGX_HTTP_LOC_CONF_OFFSET,
0,
(void *) ngx_http_lua_body_filter_inline },
@ -173,7 +173,7 @@
{ ngx_string("body_filter_by_lua_file"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
@@ -475,12 +497,14 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -480,12 +502,14 @@ static ngx_command_t ngx_http_lua_cmds[]
0,
(void *) ngx_http_lua_body_filter_file },
@ -188,7 +188,7 @@
{ ngx_string("balancer_by_lua_file"),
NGX_HTTP_UPS_CONF|NGX_CONF_TAKE1,
@@ -585,12 +609,14 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -590,12 +614,14 @@ static ngx_command_t ngx_http_lua_cmds[]
offsetof(ngx_http_lua_loc_conf_t, ssl_ciphers),
NULL },
@ -203,7 +203,7 @@
{ ngx_string("ssl_client_hello_by_lua_file"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
@@ -599,12 +625,14 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -604,12 +630,14 @@ static ngx_command_t ngx_http_lua_cmds[]
0,
(void *) ngx_http_lua_ssl_client_hello_handler_file },
@ -218,7 +218,7 @@
{ ngx_string("ssl_certificate_by_lua_file"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
@@ -613,12 +641,14 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -618,12 +646,14 @@ static ngx_command_t ngx_http_lua_cmds[]
0,
(void *) ngx_http_lua_ssl_cert_handler_file },
@ -233,7 +233,7 @@
{ ngx_string("ssl_session_store_by_lua_file"),
NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
@@ -627,12 +657,14 @@ static ngx_command_t ngx_http_lua_cmds[]
@@ -632,12 +662,14 @@ static ngx_command_t ngx_http_lua_cmds[]
0,
(void *) ngx_http_lua_ssl_sess_store_handler_file },

View file

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=tailscale
PKG_VERSION:=1.48.1
PKG_RELEASE:=2
PKG_VERSION:=1.48.2
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/tailscale/tailscale/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=6b3152cdd9ed915c01ce30f3967c0d4e04e2a81053eddeb93792d93088fe2d72
PKG_HASH:=1c34c5c2c3b78e59ffb824b356418ff828653c62885b126d0d05f300218b36b5
PKG_MAINTAINER:=Jan Pavlinec <jan.pavlinec1@gmail.com>
PKG_LICENSE:=BSD-3-Clause

View file

@ -1,12 +1,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=uwsgi
PKG_VERSION:=2.0.21
PKG_VERSION:=2.0.22
PKG_RELEASE:=1
PYPI_NAME:=uWSGI
PYPI_SOURCE_NAME:=uwsgi
PKG_HASH:=35a30d83791329429bc04fe44183ce4ab512fcf6968070a7bfba42fc5a0552a9
PKG_HASH:=4cc4727258671ac5fa17ab422155e9aaef8a2008ebb86e4404b66deaae965db2
PKG_LICENSE:=GPL-2.0-or-later
PKG_LICENSE_FILES:=LICENSE
@ -34,7 +34,7 @@ define Package/uwsgi
SUBMENU:=Web Servers/Proxies
TITLE:=The uWSGI server
URL:=https://uwsgi-docs.readthedocs.io/en/latest/
DEPENDS:=+libpcre +libcap +libuuid
DEPENDS:=+libpcre2 +libcap +libuuid
endef
define Package/uwsgi-logfile-plugin

View file

@ -1,6 +1,6 @@
--- a/uwsgiconfig.py
+++ b/uwsgiconfig.py
@@ -5,9 +5,9 @@ uwsgi_version = '2.0.21'
@@ -5,9 +5,9 @@ uwsgi_version = '2.0.22'
import os
import re
import time

View file

@ -0,0 +1,20 @@
From bad0edfc10a80de908a3d83c7f075eff8df3a691 Mon Sep 17 00:00:00 2001
From: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Date: Wed, 14 Jan 2015 21:19:24 +0100
Subject: [PATCH] core/alarm: fix memory leak
Reported by Coverity as CID #971006
---
core/alarm.c | 1 +
1 file changed, 1 insertion(+)
--- a/core/alarm.c
+++ b/core/alarm.c
@@ -171,6 +171,7 @@ static int uwsgi_alarm_log_add(char *ala
ual = uwsgi_calloc(sizeof(struct uwsgi_alarm_log));
if (uwsgi_regexp_build(regexp, &ual->pattern, &ual->pattern_extra)) {
+ free(ual);
return -1;
}
ual->negate = negate;

View file

@ -0,0 +1,23 @@
From b55d659c2ef6fb80b3b5d70192b1271992c393fc Mon Sep 17 00:00:00 2001
From: Mathieu Lacage <mathieu.lacage@gmail.com>
Date: Tue, 30 Oct 2018 17:08:19 +0100
Subject: [PATCH] ssl-option can't be set
The ssl-option variable can't be set: it is designed to take a numeric argument but is specified as a "no_argument" option which results in an error when trying to set this option. This changeset sets the proper type.
Given the changeset which introduced this option with the ssl-enable3 option which is of type no_argument, I suspect someone copy/pasted the ssl-enable3 configuration file without testing the change.
---
core/uwsgi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/core/uwsgi.c
+++ b/core/uwsgi.c
@@ -678,7 +678,7 @@ static struct uwsgi_option uwsgi_base_op
{"ssl-enable3", no_argument, 0, "enable SSLv3 (insecure)", uwsgi_opt_true, &uwsgi.sslv3, 0},
{"ssl-enable-sslv3", no_argument, 0, "enable SSLv3 (insecure)", uwsgi_opt_true, &uwsgi.sslv3, 0},
{"ssl-enable-tlsv1", no_argument, 0, "enable TLSv1 (insecure)", uwsgi_opt_true, &uwsgi.tlsv1, 0},
- {"ssl-option", no_argument, 0, "set a raw ssl option (numeric value)", uwsgi_opt_add_string_list, &uwsgi.ssl_options, 0},
+ {"ssl-option", required_argument, 0, "set a raw ssl option (numeric value)", uwsgi_opt_add_string_list, &uwsgi.ssl_options, 0},
#ifdef UWSGI_PCRE
{"sni-regexp", required_argument, 0, "add an SNI-governed SSL context (the key is a regexp)", uwsgi_opt_sni, NULL, 0},
#endif

View file

@ -1,6 +1,6 @@
--- a/core/uwsgi.c
+++ b/core/uwsgi.c
@@ -1822,7 +1822,7 @@ void uwsgi_plugins_atexit(void) {
@@ -1825,7 +1825,7 @@ void uwsgi_plugins_atexit(void) {
void uwsgi_backtrace(int depth) {

View file

@ -0,0 +1,887 @@
From 7835662f76831a76e4cc04791fcf2ee1ea725931 Mon Sep 17 00:00:00 2001
From: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Date: Tue, 25 Jul 2023 16:17:52 +0200
Subject: [PATCH 01/12] uwsgiconfig: prepare for pcre2
---
uwsgiconfig.py | 45 ++++++++++++++++++++++-----------------------
1 file changed, 22 insertions(+), 23 deletions(-)
--- a/uwsgiconfig.py
+++ b/uwsgiconfig.py
@@ -1079,30 +1079,29 @@ class uConf(object):
has_pcre = False
- # re-enable after pcre fix
- if self.get('pcre'):
- if self.get('pcre') == 'auto':
- pcreconf = spcall('pcre-config --libs')
- if pcreconf:
- self.libs.append(pcreconf)
- pcreconf = spcall("pcre-config --cflags")
- self.cflags.append(pcreconf)
- self.gcc_list.append('core/regexp')
- self.cflags.append("-DUWSGI_PCRE")
- has_pcre = True
-
+ required_pcre = self.get('pcre')
+ if required_pcre:
+ pcre_libs = spcall('pcre2-config --libs8')
+ if pcre_libs:
+ pcre_cflags = spcall("pcre2-config --cflags")
+ pcre_define = "-DUWSGI_PCRE2"
else:
- pcreconf = spcall('pcre-config --libs')
- if pcreconf is None:
- print("*** libpcre headers unavailable. uWSGI build is interrupted. You have to install pcre development package or disable pcre")
- sys.exit(1)
- else:
- self.libs.append(pcreconf)
- pcreconf = spcall("pcre-config --cflags")
- self.cflags.append(pcreconf)
- self.gcc_list.append('core/regexp')
- self.cflags.append("-DUWSGI_PCRE")
- has_pcre = True
+ pcre_libs = spcall('pcre-config --libs')
+ pcre_cflags = spcall("pcre-config --cflags")
+ pcre_define = "-DUWSGI_PCRE"
+ else:
+ pcre_libs = None
+
+ if required_pcre:
+ if required_pcre != 'auto' and pcre_libs is None:
+ print("*** libpcre headers unavailable. uWSGI build is interrupted. You have to install pcre development package or disable pcre")
+ sys.exit(1)
+
+ self.libs.append(pcre_libs)
+ self.cflags.append(pcre_cflags)
+ self.gcc_list.append('core/regexp')
+ self.cflags.append(pcre_define)
+ has_pcre = True
if has_pcre:
report['pcre'] = True
--- a/core/alarm.c
+++ b/core/alarm.c
@@ -160,7 +160,7 @@ static struct uwsgi_alarm_instance *uwsg
}
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
static int uwsgi_alarm_log_add(char *alarms, char *regexp, int negate) {
struct uwsgi_alarm_log *old_ual = NULL, *ual = uwsgi.alarm_logs;
@@ -170,7 +170,7 @@ static int uwsgi_alarm_log_add(char *ala
}
ual = uwsgi_calloc(sizeof(struct uwsgi_alarm_log));
- if (uwsgi_regexp_build(regexp, &ual->pattern, &ual->pattern_extra)) {
+ if (uwsgi_regexp_build(regexp, &ual->pattern)) {
free(ual);
return -1;
}
@@ -331,7 +331,7 @@ void uwsgi_alarms_init() {
usl = usl->next;
}
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
// then map log-alarm
usl = uwsgi.alarm_logs_list;
while (usl) {
@@ -377,14 +377,14 @@ void uwsgi_alarm_trigger_uai(struct uwsg
}
}
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
// check if a log should raise an alarm
void uwsgi_alarm_log_check(char *msg, size_t len) {
if (!uwsgi_strncmp(msg, len, "[uwsgi-alarm", 12))
return;
struct uwsgi_alarm_log *ual = uwsgi.alarm_logs;
while (ual) {
- if (uwsgi_regexp_match(ual->pattern, ual->pattern_extra, msg, len) >= 0) {
+ if (uwsgi_regexp_match(ual->pattern, msg, len) >= 0) {
if (!ual->negate) {
struct uwsgi_alarm_ll *uall = ual->alarms;
while (uall) {
--- a/core/logging.c
+++ b/core/logging.c
@@ -414,7 +414,7 @@ void uwsgi_setup_log_master(void) {
usl = usl->next;
}
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
// set logger by its id
struct uwsgi_regexp_list *url = uwsgi.log_route;
while (url) {
@@ -1398,11 +1398,11 @@ int uwsgi_master_log(void) {
ssize_t rlen = read(uwsgi.shared->worker_log_pipe[0], uwsgi.log_master_buf, uwsgi.log_master_bufsize);
if (rlen > 0) {
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
uwsgi_alarm_log_check(uwsgi.log_master_buf, rlen);
struct uwsgi_regexp_list *url = uwsgi.log_drain_rules;
while (url) {
- if (uwsgi_regexp_match(url->pattern, url->pattern_extra, uwsgi.log_master_buf, rlen) >= 0) {
+ if (uwsgi_regexp_match(url->pattern, uwsgi.log_master_buf, rlen) >= 0) {
return 0;
}
url = url->next;
@@ -1411,7 +1411,7 @@ int uwsgi_master_log(void) {
int show = 0;
url = uwsgi.log_filter_rules;
while (url) {
- if (uwsgi_regexp_match(url->pattern, url->pattern_extra, uwsgi.log_master_buf, rlen) >= 0) {
+ if (uwsgi_regexp_match(url->pattern, uwsgi.log_master_buf, rlen) >= 0) {
show = 1;
break;
}
@@ -1424,7 +1424,7 @@ int uwsgi_master_log(void) {
url = uwsgi.log_route;
int finish = 0;
while (url) {
- if (uwsgi_regexp_match(url->pattern, url->pattern_extra, uwsgi.log_master_buf, rlen) >= 0) {
+ if (uwsgi_regexp_match(url->pattern, uwsgi.log_master_buf, rlen) >= 0) {
struct uwsgi_logger *ul_route = (struct uwsgi_logger *) url->custom_ptr;
if (ul_route) {
uwsgi_log_func_do(uwsgi.requested_log_encoders, ul_route, uwsgi.log_master_buf, rlen);
@@ -1464,11 +1464,11 @@ int uwsgi_master_req_log(void) {
ssize_t rlen = read(uwsgi.shared->worker_req_log_pipe[0], uwsgi.log_master_buf, uwsgi.log_master_bufsize);
if (rlen > 0) {
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
struct uwsgi_regexp_list *url = uwsgi.log_req_route;
int finish = 0;
while (url) {
- if (uwsgi_regexp_match(url->pattern, url->pattern_extra, uwsgi.log_master_buf, rlen) >= 0) {
+ if (uwsgi_regexp_match(url->pattern, uwsgi.log_master_buf, rlen) >= 0) {
struct uwsgi_logger *ul_route = (struct uwsgi_logger *) url->custom_ptr;
if (ul_route) {
uwsgi_log_func_do(uwsgi.requested_log_req_encoders, ul_route, uwsgi.log_master_buf, rlen);
--- a/core/regexp.c
+++ b/core/regexp.c
@@ -1,4 +1,4 @@
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
#include "uwsgi.h"
extern struct uwsgi_server uwsgi;
@@ -13,48 +13,110 @@ void uwsgi_opt_pcre_jit(char *opt, char
#endif
}
-int uwsgi_regexp_build(char *re, pcre ** pattern, pcre_extra ** pattern_extra) {
+int uwsgi_regexp_build(char *re, uwsgi_pcre ** pattern) {
+#ifdef UWSGI_PCRE2
+ int errnbr;
+ long unsigned int erroff;
+
+ *pattern = pcre2_compile((const unsigned char *) re, PCRE2_ZERO_TERMINATED, 0, &errnbr, &erroff, NULL);
+#else
const char *errstr;
int erroff;
- *pattern = pcre_compile((const char *) re, 0, &errstr, &erroff, NULL);
- if (!*pattern) {
+ *pattern = uwsgi_malloc(sizeof(uwsgi_pcre));
+ (*pattern)->p = pcre_compile((const char *) re, 0, &errstr, &erroff, NULL);
+#endif
+#ifdef UWSGI_PCRE2
+ if (!(*pattern)) {
+ uwsgi_log("pcre error: code %d at offset %d\n", errnbr, erroff);
+#else
+ if (!((*pattern)->p)) {
uwsgi_log("pcre error: %s at offset %d\n", errstr, erroff);
+#endif
return -1;
}
+#ifdef UWSGI_PCRE2
+ if (uwsgi.pcre_jit) {
+ errnbr = pcre2_jit_compile(*pattern, PCRE2_JIT_COMPLETE);
+ if (errnbr) {
+ pcre2_code_free(*pattern);
+ uwsgi_log("pcre JIT compile error code %d\n", errnbr);
+ return -1;
+ }
+#else
int opt = uwsgi.pcre_jit;
- *pattern_extra = (pcre_extra *) pcre_study((const pcre *) *pattern, opt, &errstr);
- if (*pattern_extra == NULL && errstr != NULL) {
- pcre_free(*pattern);
+ (*pattern)->extra = (pcre_extra *) pcre_study((const pcre *) (*pattern)->p, opt, &errstr);
+ if ((*pattern)->extra == NULL && errstr != NULL) {
+ pcre_free((*pattern)->p);
+ free(*pattern);
uwsgi_log("pcre (study) error: %s\n", errstr);
return -1;
+#endif
}
return 0;
}
-int uwsgi_regexp_match(pcre * pattern, pcre_extra * pattern_extra, char *subject, int length) {
-
- return pcre_exec((const pcre *) pattern, (const pcre_extra *) pattern_extra, subject, length, 0, 0, NULL, 0);
+int uwsgi_regexp_match(uwsgi_pcre *pattern, const char *subject, int length) {
+#ifdef UWSGI_PCRE2
+ return pcre2_match(pattern, (const unsigned char *)subject, length, 0, 0, NULL, NULL);
+#else
+ return pcre_exec((const pcre *) pattern->p, (const pcre_extra *) pattern->extra, subject, length, 0, 0, NULL, 0);
+#endif
}
-int uwsgi_regexp_match_ovec(pcre * pattern, pcre_extra * pattern_extra, char *subject, int length, int *ovec, int n) {
+int uwsgi_regexp_match_ovec(uwsgi_pcre *pattern, const char *subject, int length, int *ovec, int n) {
+
+#ifdef UWSGI_PCRE2
+ int rc;
+ int i;
+ pcre2_match_data *match_data;
+ size_t *pcre2_ovec;
+
+ match_data = pcre2_match_data_create_from_pattern(pattern, NULL);
+ rc = pcre2_match(pattern, (const unsigned char *)subject, length, 0, 0, match_data, NULL);
+ /*
+ * Quoting PCRE{,2} spec, "The first pair of integers, ovector[0]
+ * and ovector[1], identify the portion of the subject string matched
+ * by the entire pattern. The next pair is used for the first capturing
+ * subpattern, and so on." Therefore, the ovector size is the number of
+ * capturing subpatterns (INFO_CAPTURECOUNT), from uwsgi_regexp_ovector(),
+ * as matching pairs, plus room for the first pair.
+ */
if (n > 0) {
- return pcre_exec((const pcre *) pattern, (const pcre_extra *) pattern_extra, subject, length, 0, 0, ovec, (n + 1) * 3);
+ // copy pcre2 output vector to uwsgi output vector
+ pcre2_ovec = pcre2_get_ovector_pointer(match_data);
+ for (i=0;i<(n+1)*2;i++) {
+ ovec[i] = pcre2_ovec[i];
+ }
+#else
+ if (n > 0) {
+ return pcre_exec((const pcre *) pattern->p, (const pcre_extra *) pattern->extra, subject, length, 0, 0, ovec, PCRE_OVECTOR_BYTESIZE(n));
+#endif
}
- return pcre_exec((const pcre *) pattern, (const pcre_extra *) pattern_extra, subject, length, 0, 0, NULL, 0);
+
+#ifdef UWSGI_PCRE2
+ pcre2_match_data_free(match_data);
+
+ return rc;
+#else
+ return pcre_exec((const pcre *) pattern->p, (const pcre_extra *) pattern->extra, subject, length, 0, 0, NULL, 0);
+#endif
}
-int uwsgi_regexp_ovector(pcre * pattern, pcre_extra * pattern_extra) {
+int uwsgi_regexp_ovector(const uwsgi_pcre *pattern) {
int n;
-
- if (pcre_fullinfo((const pcre *) pattern, (const pcre_extra *) pattern_extra, PCRE_INFO_CAPTURECOUNT, &n))
+#ifdef UWSGI_PCRE2
+ if (pcre2_pattern_info(pattern, PCRE2_INFO_CAPTURECOUNT, &n))
+#else
+ if (pcre_fullinfo((const pcre *) pattern->p, (const pcre_extra *) pattern->extra, PCRE_INFO_CAPTURECOUNT, &n))
+#endif
return 0;
return n;
@@ -66,7 +128,7 @@ char *uwsgi_regexp_apply_ovec(char *src,
int dollar = 0;
size_t dollars = n;
-
+
for(i=0;i<dst_n;i++) {
if (dst[i] == '$') {
dollars++;
--- a/core/routing.c
+++ b/core/routing.c
@@ -211,7 +211,7 @@ int uwsgi_apply_routes_do(struct uwsgi_r
subject = *subject2 ;
subject_len = *subject_len2;
}
- n = uwsgi_regexp_match_ovec(routes->pattern, routes->pattern_extra, subject, subject_len, routes->ovector[wsgi_req->async_id], routes->ovn[wsgi_req->async_id]);
+ n = uwsgi_regexp_match_ovec(routes->pattern, subject, subject_len, routes->ovector[wsgi_req->async_id], routes->ovn[wsgi_req->async_id]);
}
else {
int ret = routes->if_func(wsgi_req, routes);
@@ -506,15 +506,15 @@ void uwsgi_fixup_routes(struct uwsgi_rou
// fill them if needed... (this is an optimization for route with a static subject)
if (ur->subject && ur->subject_len) {
- if (uwsgi_regexp_build(ur->orig_route, &ur->pattern, &ur->pattern_extra)) {
+ if (uwsgi_regexp_build(ur->orig_route, &ur->pattern)) {
exit(1);
}
int i;
for(i=0;i<uwsgi.cores;i++) {
- ur->ovn[i] = uwsgi_regexp_ovector(ur->pattern, ur->pattern_extra);
+ ur->ovn[i] = uwsgi_regexp_ovector(ur->pattern);
if (ur->ovn[i] > 0) {
- ur->ovector[i] = uwsgi_calloc(sizeof(int) * (3 * (ur->ovn[i] + 1)));
+ ur->ovector[i] = uwsgi_calloc(sizeof(int) * PCRE_OVECTOR_BYTESIZE(ur->ovn[i]));
}
}
}
@@ -1484,38 +1484,47 @@ static int uwsgi_route_condition_regexp(
ur->condition_ub[wsgi_req->async_id] = uwsgi_routing_translate(wsgi_req, ur, NULL, 0, ur->subject_str, semicolon - ur->subject_str);
if (!ur->condition_ub[wsgi_req->async_id]) return -1;
- pcre *pattern;
- pcre_extra *pattern_extra;
+ uwsgi_pcre *pattern;
char *re = uwsgi_concat2n(semicolon+1, ur->subject_str_len - ((semicolon+1) - ur->subject_str), "", 0);
- if (uwsgi_regexp_build(re, &pattern, &pattern_extra)) {
+ if (uwsgi_regexp_build(re, &pattern)) {
free(re);
return -1;
}
free(re);
// a condition has no initialized vectors, let's create them
- ur->ovn[wsgi_req->async_id] = uwsgi_regexp_ovector(pattern, pattern_extra);
+ ur->ovn[wsgi_req->async_id] = uwsgi_regexp_ovector(pattern);
if (ur->ovn[wsgi_req->async_id] > 0) {
ur->ovector[wsgi_req->async_id] = uwsgi_calloc(sizeof(int) * (3 * (ur->ovn[wsgi_req->async_id] + 1)));
}
- if (uwsgi_regexp_match_ovec(pattern, pattern_extra, ur->condition_ub[wsgi_req->async_id]->buf, ur->condition_ub[wsgi_req->async_id]->pos, ur->ovector[wsgi_req->async_id], ur->ovn[wsgi_req->async_id] ) >= 0) {
- pcre_free(pattern);
+ if (uwsgi_regexp_match_ovec(pattern, ur->condition_ub[wsgi_req->async_id]->buf, ur->condition_ub[wsgi_req->async_id]->pos, ur->ovector[wsgi_req->async_id], ur->ovn[wsgi_req->async_id] ) >= 0) {
+#ifdef UWSGI_PCRE2
+ pcre2_code_free(pattern);
+#else
+ pcre_free(pattern->p);
#ifdef PCRE_STUDY_JIT_COMPILE
- pcre_free_study(pattern_extra);
+ pcre_free_study(pattern->extra);
#else
- pcre_free(pattern_extra);
+ pcre_free(pattern->extra);
+#endif
+ free(pattern);
#endif
return 1;
}
- pcre_free(pattern);
+#ifdef UWSGI_PCRE2
+ pcre2_code_free(pattern);
+#else
+ pcre_free(pattern->p);
#ifdef PCRE_STUDY_JIT_COMPILE
- pcre_free_study(pattern_extra);
+ pcre_free_study(pattern->extra);
#else
- pcre_free(pattern_extra);
+ pcre_free(pattern->extra);
#endif
- return 0;
+ free(pattern);
+#endif
+ return 0;
}
static int uwsgi_route_condition_empty(struct wsgi_request *wsgi_req, struct uwsgi_route *ur) {
--- a/core/ssl.c
+++ b/core/ssl.c
@@ -145,10 +145,10 @@ static int uwsgi_sni_cb(SSL *ssl, int *a
if (uwsgi.subscription_dotsplit) goto end;
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
struct uwsgi_regexp_list *url = uwsgi.sni_regexp;
while(url) {
- if (uwsgi_regexp_match(url->pattern, url->pattern_extra, (char *)servername, servername_len) >= 0) {
+ if (uwsgi_regexp_match(url->pattern, (char *)servername, servername_len) >= 0) {
SSL_set_SSL_CTX(ssl, url->custom_ptr);
return SSL_TLSEXT_ERR_OK;
}
@@ -621,7 +621,7 @@ void uwsgi_opt_sni(char *opt, char *valu
return;
}
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
if (!strcmp(opt, "sni-regexp")) {
struct uwsgi_regexp_list *url = uwsgi_regexp_new_list(&uwsgi.sni_regexp, v);
url->custom_ptr = ctx;
@@ -630,7 +630,7 @@ void uwsgi_opt_sni(char *opt, char *valu
#endif
struct uwsgi_string_list *usl = uwsgi_string_new_list(&uwsgi.sni, v);
usl->custom_ptr = ctx;
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
}
#endif
--- a/core/static.c
+++ b/core/static.c
@@ -35,11 +35,11 @@ int uwsgi_static_want_gzip(struct wsgi_r
usl = usl->next;
}
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
// check for regexp
struct uwsgi_regexp_list *url = uwsgi.static_gzip;
while(url) {
- if (uwsgi_regexp_match(url->pattern, url->pattern_extra, filename, *filename_len) >= 0) {
+ if (uwsgi_regexp_match(url->pattern, filename, *filename_len) >= 0) {
goto gzip;
}
url = url->next;
@@ -216,7 +216,7 @@ int uwsgi_add_expires_type(struct wsgi_r
return 0;
}
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
int uwsgi_add_expires(struct wsgi_request *wsgi_req, char *filename, int filename_len, struct stat *st) {
struct uwsgi_dyn_dict *udd = uwsgi.static_expires;
@@ -225,7 +225,7 @@ int uwsgi_add_expires(struct wsgi_reques
char expires[31];
while (udd) {
- if (uwsgi_regexp_match(udd->pattern, udd->pattern_extra, filename, filename_len) >= 0) {
+ if (uwsgi_regexp_match(udd->pattern, filename, filename_len) >= 0) {
int delta = uwsgi_str_num(udd->value, udd->vallen);
int size = uwsgi_http_date(now + delta, expires);
if (size > 0) {
@@ -238,7 +238,7 @@ int uwsgi_add_expires(struct wsgi_reques
udd = uwsgi.static_expires_mtime;
while (udd) {
- if (uwsgi_regexp_match(udd->pattern, udd->pattern_extra, filename, filename_len) >= 0) {
+ if (uwsgi_regexp_match(udd->pattern, filename, filename_len) >= 0) {
int delta = uwsgi_str_num(udd->value, udd->vallen);
int size = uwsgi_http_date(st->st_mtime + delta, expires);
if (size > 0) {
@@ -260,7 +260,7 @@ int uwsgi_add_expires_path_info(struct w
char expires[31];
while (udd) {
- if (uwsgi_regexp_match(udd->pattern, udd->pattern_extra, wsgi_req->path_info, wsgi_req->path_info_len) >= 0) {
+ if (uwsgi_regexp_match(udd->pattern, wsgi_req->path_info, wsgi_req->path_info_len) >= 0) {
int delta = uwsgi_str_num(udd->value, udd->vallen);
int size = uwsgi_http_date(now + delta, expires);
if (size > 0) {
@@ -273,7 +273,7 @@ int uwsgi_add_expires_path_info(struct w
udd = uwsgi.static_expires_path_info_mtime;
while (udd) {
- if (uwsgi_regexp_match(udd->pattern, udd->pattern_extra, wsgi_req->path_info, wsgi_req->path_info_len) >= 0) {
+ if (uwsgi_regexp_match(udd->pattern, wsgi_req->path_info, wsgi_req->path_info_len) >= 0) {
int delta = uwsgi_str_num(udd->value, udd->vallen);
int size = uwsgi_http_date(st->st_mtime + delta, expires);
if (size > 0) {
@@ -295,7 +295,7 @@ int uwsgi_add_expires_uri(struct wsgi_re
char expires[31];
while (udd) {
- if (uwsgi_regexp_match(udd->pattern, udd->pattern_extra, wsgi_req->uri, wsgi_req->uri_len) >= 0) {
+ if (uwsgi_regexp_match(udd->pattern, wsgi_req->uri, wsgi_req->uri_len) >= 0) {
int delta = uwsgi_str_num(udd->value, udd->vallen);
int size = uwsgi_http_date(now + delta, expires);
if (size > 0) {
@@ -308,7 +308,7 @@ int uwsgi_add_expires_uri(struct wsgi_re
udd = uwsgi.static_expires_uri_mtime;
while (udd) {
- if (uwsgi_regexp_match(udd->pattern, udd->pattern_extra, wsgi_req->uri, wsgi_req->uri_len) >= 0) {
+ if (uwsgi_regexp_match(udd->pattern, wsgi_req->uri, wsgi_req->uri_len) >= 0) {
int delta = uwsgi_str_num(udd->value, udd->vallen);
int size = uwsgi_http_date(st->st_mtime + delta, expires);
if (size > 0) {
@@ -507,7 +507,7 @@ int uwsgi_real_file_serve(struct wsgi_re
if (uwsgi_response_prepare_headers(wsgi_req, "200 OK", 6)) return -1;
}
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
uwsgi_add_expires(wsgi_req, real_filename, real_filename_len, st);
uwsgi_add_expires_path_info(wsgi_req, st);
uwsgi_add_expires_uri(wsgi_req, st);
--- a/core/utils.c
+++ b/core/utils.c
@@ -2301,7 +2301,7 @@ struct uwsgi_string_list *uwsgi_string_n
return uwsgi_string;
}
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
struct uwsgi_regexp_list *uwsgi_regexp_custom_new_list(struct uwsgi_regexp_list **list, char *value, char *custom) {
struct uwsgi_regexp_list *url = *list, *old_url;
@@ -2320,7 +2320,7 @@ struct uwsgi_regexp_list *uwsgi_regexp_c
old_url->next = url;
}
- if (uwsgi_regexp_build(value, &url->pattern, &url->pattern_extra)) {
+ if (uwsgi_regexp_build(value, &url->pattern)) {
exit(1);
}
url->next = NULL;
@@ -2333,14 +2333,13 @@ struct uwsgi_regexp_list *uwsgi_regexp_c
int uwsgi_regexp_match_pattern(char *pattern, char *str) {
- pcre *regexp;
- pcre_extra *regexp_extra;
+ uwsgi_pcre *regexp;
- if (uwsgi_regexp_build(pattern, &regexp, &regexp_extra))
+ if (uwsgi_regexp_build(pattern, &regexp))
return 1;
- return !uwsgi_regexp_match(regexp, regexp_extra, str, strlen(str));
-}
+ return !uwsgi_regexp_match(regexp, str, strlen(str));
+}
#endif
--- a/core/uwsgi.c
+++ b/core/uwsgi.c
@@ -130,7 +130,7 @@ static struct uwsgi_option uwsgi_base_op
{"if-hostname", required_argument, 0, "(opt logic) check for hostname", uwsgi_opt_logic, (void *) uwsgi_logic_opt_if_hostname, UWSGI_OPT_IMMEDIATE},
{"if-not-hostname", required_argument, 0, "(opt logic) check for hostname", uwsgi_opt_logic, (void *) uwsgi_logic_opt_if_not_hostname, UWSGI_OPT_IMMEDIATE},
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
{"if-hostname-match", required_argument, 0, "(opt logic) try to match hostname against a regular expression", uwsgi_opt_logic, (void *) uwsgi_logic_opt_if_hostname_match, UWSGI_OPT_IMMEDIATE},
{"if-not-hostname-match", required_argument, 0, "(opt logic) try to match hostname against a regular expression", uwsgi_opt_logic, (void *) uwsgi_logic_opt_if_not_hostname_match, UWSGI_OPT_IMMEDIATE},
#endif
@@ -548,7 +548,7 @@ static struct uwsgi_option uwsgi_base_op
{"ksm", optional_argument, 0, "enable Linux KSM", uwsgi_opt_set_int, &uwsgi.linux_ksm, 0},
#endif
#endif
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
{"pcre-jit", no_argument, 0, "enable pcre jit (if available)", uwsgi_opt_pcre_jit, NULL, UWSGI_OPT_IMMEDIATE},
#endif
{"never-swap", no_argument, 0, "lock all memory pages avoiding swapping", uwsgi_opt_true, &uwsgi.never_swap, 0},
@@ -679,7 +679,7 @@ static struct uwsgi_option uwsgi_base_op
{"ssl-enable-sslv3", no_argument, 0, "enable SSLv3 (insecure)", uwsgi_opt_true, &uwsgi.sslv3, 0},
{"ssl-enable-tlsv1", no_argument, 0, "enable TLSv1 (insecure)", uwsgi_opt_true, &uwsgi.tlsv1, 0},
{"ssl-option", required_argument, 0, "set a raw ssl option (numeric value)", uwsgi_opt_add_string_list, &uwsgi.ssl_options, 0},
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
{"sni-regexp", required_argument, 0, "add an SNI-governed SSL context (the key is a regexp)", uwsgi_opt_sni, NULL, 0},
#endif
{"ssl-tmp-dir", required_argument, 0, "store ssl-related temp files in the specified directory", uwsgi_opt_set_str, &uwsgi.ssl_tmp_dir, 0},
@@ -715,7 +715,7 @@ static struct uwsgi_option uwsgi_base_op
{"log-req-encoder", required_argument, 0, "add an item in the log req encoder chain", uwsgi_opt_add_string_list, &uwsgi.requested_log_req_encoders, UWSGI_OPT_MASTER | UWSGI_OPT_LOG_MASTER},
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
{"log-drain", required_argument, 0, "drain (do not show) log lines matching the specified regexp", uwsgi_opt_add_regexp_list, &uwsgi.log_drain_rules, UWSGI_OPT_MASTER | UWSGI_OPT_LOG_MASTER},
{"log-filter", required_argument, 0, "show only log lines matching the specified regexp", uwsgi_opt_add_regexp_list, &uwsgi.log_filter_rules, UWSGI_OPT_MASTER | UWSGI_OPT_LOG_MASTER},
{"log-route", required_argument, 0, "log to the specified named logger if regexp applied on logline matches", uwsgi_opt_add_regexp_custom_list, &uwsgi.log_route, UWSGI_OPT_MASTER | UWSGI_OPT_LOG_MASTER},
@@ -736,7 +736,7 @@ static struct uwsgi_option uwsgi_base_op
{"alarm-lq", required_argument, 0, "raise the specified alarm when the socket backlog queue is full", uwsgi_opt_add_string_list, &uwsgi.alarm_backlog, UWSGI_OPT_MASTER},
{"alarm-listen-queue", required_argument, 0, "raise the specified alarm when the socket backlog queue is full", uwsgi_opt_add_string_list, &uwsgi.alarm_backlog, UWSGI_OPT_MASTER},
{"listen-queue-alarm", required_argument, 0, "raise the specified alarm when the socket backlog queue is full", uwsgi_opt_add_string_list, &uwsgi.alarm_backlog, UWSGI_OPT_MASTER},
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
{"log-alarm", required_argument, 0, "raise the specified alarm when a log line matches the specified regexp, syntax: <alarm>[,alarm...] <regexp>", uwsgi_opt_add_string_list, &uwsgi.alarm_logs_list, UWSGI_OPT_MASTER | UWSGI_OPT_LOG_MASTER},
{"alarm-log", required_argument, 0, "raise the specified alarm when a log line matches the specified regexp, syntax: <alarm>[,alarm...] <regexp>", uwsgi_opt_add_string_list, &uwsgi.alarm_logs_list, UWSGI_OPT_MASTER | UWSGI_OPT_LOG_MASTER},
{"not-log-alarm", required_argument, 0, "skip the specified alarm when a log line matches the specified regexp, syntax: <alarm>[,alarm...] <regexp>", uwsgi_opt_add_string_list_custom, &uwsgi.alarm_logs_list, UWSGI_OPT_MASTER | UWSGI_OPT_LOG_MASTER},
@@ -915,7 +915,7 @@ static struct uwsgi_option uwsgi_base_op
{"static-expires-type", required_argument, 0, "set the Expires header based on content type", uwsgi_opt_add_dyn_dict, &uwsgi.static_expires_type, UWSGI_OPT_MIME},
{"static-expires-type-mtime", required_argument, 0, "set the Expires header based on content type and file mtime", uwsgi_opt_add_dyn_dict, &uwsgi.static_expires_type_mtime, UWSGI_OPT_MIME},
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
{"static-expires", required_argument, 0, "set the Expires header based on filename regexp", uwsgi_opt_add_regexp_dyn_dict, &uwsgi.static_expires, UWSGI_OPT_MIME},
{"static-expires-mtime", required_argument, 0, "set the Expires header based on filename regexp and file mtime", uwsgi_opt_add_regexp_dyn_dict, &uwsgi.static_expires_mtime, UWSGI_OPT_MIME},
@@ -2424,7 +2424,7 @@ void uwsgi_setup(int argc, char *argv[],
}
uwsgi_log_initial("clock source: %s\n", uwsgi.clock->name);
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
if (uwsgi.pcre_jit) {
uwsgi_log_initial("pcre jit enabled\n");
}
@@ -4186,7 +4186,7 @@ void uwsgi_opt_add_string_list_custom(ch
usl->custom = 1;
}
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
void uwsgi_opt_add_regexp_list(char *opt, char *value, void *list) {
struct uwsgi_regexp_list **ptr = (struct uwsgi_regexp_list **) list;
uwsgi_regexp_new_list(ptr, value);
@@ -4452,7 +4452,7 @@ void uwsgi_opt_add_dyn_dict(char *opt, c
}
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
void uwsgi_opt_add_regexp_dyn_dict(char *opt, char *value, void *dict) {
char *space = strchr(value, ' ');
@@ -4467,7 +4467,7 @@ void uwsgi_opt_add_regexp_dyn_dict(char
char *regexp = uwsgi_concat2n(value, space - value, "", 0);
- if (uwsgi_regexp_build(regexp, &new_udd->pattern, &new_udd->pattern_extra)) {
+ if (uwsgi_regexp_build(regexp, &new_udd->pattern)) {
exit(1);
}
--- a/uwsgi.h
+++ b/uwsgi.h
@@ -438,8 +438,26 @@ struct uwsgi_lock_ops {
#define uwsgi_wait_read_req(x) uwsgi.wait_read_hook(x->fd, uwsgi.socket_timeout) ; x->switches++
#define uwsgi_wait_write_req(x) uwsgi.wait_write_hook(x->fd, uwsgi.socket_timeout) ; x->switches++
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
+#ifdef UWSGI_PCRE2
+
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include <pcre2.h>
+#define PCRE_OVECTOR_BYTESIZE(n) (n+1)*2
+
+typedef pcre2_code uwsgi_pcre;
+
+#else
+
#include <pcre.h>
+#define PCRE_OVECTOR_BYTESIZE(n) (n+1)*3
+
+typedef struct {
+ pcre *p;
+ pcre_extra *extra;
+} uwsgi_pcre;
+
+#endif
#endif
struct uwsgi_dyn_dict {
@@ -455,9 +473,8 @@ struct uwsgi_dyn_dict {
struct uwsgi_dyn_dict *prev;
struct uwsgi_dyn_dict *next;
-#ifdef UWSGI_PCRE
- pcre *pattern;
- pcre_extra *pattern_extra;
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
+ uwsgi_pcre *pattern;
#endif
};
@@ -468,11 +485,10 @@ struct uwsgi_hook {
struct uwsgi_hook *next;
};
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
struct uwsgi_regexp_list {
- pcre *pattern;
- pcre_extra *pattern_extra;
+ uwsgi_pcre *pattern;
uint64_t custom;
char *custom_str;
@@ -1089,11 +1105,11 @@ struct uwsgi_plugin {
void (*post_uwsgi_fork) (int);
};
-#ifdef UWSGI_PCRE
-int uwsgi_regexp_build(char *, pcre **, pcre_extra **);
-int uwsgi_regexp_match(pcre *, pcre_extra *, char *, int);
-int uwsgi_regexp_match_ovec(pcre *, pcre_extra *, char *, int, int *, int);
-int uwsgi_regexp_ovector(pcre *, pcre_extra *);
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
+int uwsgi_regexp_build(char *, uwsgi_pcre **);
+int uwsgi_regexp_match(uwsgi_pcre *, const char *, int);
+int uwsgi_regexp_match_ovec(uwsgi_pcre *, const char *, int, int *, int);
+int uwsgi_regexp_ovector(const uwsgi_pcre *);
char *uwsgi_regexp_apply_ovec(char *, int, char *, int, int *, int);
int uwsgi_regexp_match_pattern(char *pattern, char *str);
@@ -1182,8 +1198,7 @@ struct uwsgi_spooler {
struct uwsgi_route {
- pcre *pattern;
- pcre_extra *pattern_extra;
+ uwsgi_pcre *pattern;
char *orig_route;
@@ -1292,15 +1307,14 @@ struct uwsgi_alarm_fd {
struct uwsgi_alarm_fd *uwsgi_add_alarm_fd(int, char *, size_t, char *, size_t);
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
struct uwsgi_alarm_ll {
struct uwsgi_alarm_instance *alarm;
struct uwsgi_alarm_ll *next;
};
struct uwsgi_alarm_log {
- pcre *pattern;
- pcre_extra *pattern_extra;
+ uwsgi_pcre *pattern;
int negate;
struct uwsgi_alarm_ll *alarms;
struct uwsgi_alarm_log *next;
@@ -2234,7 +2248,7 @@ struct uwsgi_server {
struct uwsgi_string_list *requested_log_encoders;
struct uwsgi_string_list *requested_log_req_encoders;
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
int pcre_jit;
struct uwsgi_regexp_list *log_drain_rules;
struct uwsgi_regexp_list *log_filter_rules;
@@ -2316,7 +2330,7 @@ struct uwsgi_server {
int static_gzip_all;
struct uwsgi_string_list *static_gzip_dir;
struct uwsgi_string_list *static_gzip_ext;
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
struct uwsgi_regexp_list *static_gzip;
#endif
@@ -2715,7 +2729,7 @@ struct uwsgi_server {
int ssl_sessions_timeout;
struct uwsgi_cache *ssl_sessions_cache;
char *ssl_tmp_dir;
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
struct uwsgi_regexp_list *sni_regexp;
#endif
struct uwsgi_string_list *sni;
@@ -3584,7 +3598,7 @@ void uwsgi_shutdown_all_sockets(void);
void uwsgi_close_all_unshared_sockets(void);
struct uwsgi_string_list *uwsgi_string_new_list(struct uwsgi_string_list **, char *);
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
struct uwsgi_regexp_list *uwsgi_regexp_custom_new_list(struct uwsgi_regexp_list **, char *, char *);
#define uwsgi_regexp_new_list(x, y) uwsgi_regexp_custom_new_list(x, y, NULL);
#endif
@@ -3838,7 +3852,7 @@ void uwsgi_opt_add_addr_list(char *, cha
void uwsgi_opt_add_string_list_custom(char *, char *, void *);
void uwsgi_opt_add_dyn_dict(char *, char *, void *);
void uwsgi_opt_binary_append_data(char *, char *, void *);
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
void uwsgi_opt_pcre_jit(char *, char *, void *);
void uwsgi_opt_add_regexp_dyn_dict(char *, char *, void *);
void uwsgi_opt_add_regexp_list(char *, char *, void *);
--- a/.github/workflows/compile-test.yml
+++ b/.github/workflows/compile-test.yml
@@ -9,6 +9,10 @@ on:
jobs:
build:
+ strategy:
+ matrix:
+ libpcre: [libpcre3-dev, libpcre2-dev]
+
runs-on: ubuntu-20.04
steps:
@@ -20,7 +24,7 @@ jobs:
run: |
sudo apt update -qq
sudo apt install --no-install-recommends -qqyf python3.8-dev \
- libxml2-dev libpcre3-dev libcap2-dev \
+ libxml2-dev ${{ matrix.libpcre }} libcap2-dev \
libargon2-0-dev libsodium-dev \
php7.4-dev libphp7.4-embed \
liblua5.1-0-dev ruby2.7-dev \
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -21,7 +21,7 @@ jobs:
run: |
sudo apt update -qq
sudo apt install --no-install-recommends -qqyf python${{ matrix.python-version }}-dev \
- libpcre3-dev libjansson-dev libcap2-dev \
+ libpcre2-dev libjansson-dev libcap2-dev \
curl check
- name: Install distutils
if: contains(fromJson('["3.6","3.7","3.8","3.9","3.10","3.11"]'), matrix.python-version)
--- a/plugins/php/php_plugin.c
+++ b/plugins/php/php_plugin.c
@@ -16,7 +16,7 @@ struct uwsgi_php {
struct uwsgi_string_list *index;
struct uwsgi_string_list *set;
struct uwsgi_string_list *append_config;
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
struct uwsgi_regexp_list *app_bypass;
#endif
struct uwsgi_string_list *vars;
@@ -63,7 +63,7 @@ struct uwsgi_option uwsgi_php_options[]
{"php-fallback", required_argument, 0, "run the specified php script when the requested one does not exist", uwsgi_opt_set_str, &uphp.fallback, 0},
{"php-fallback2", required_argument, 0, "run the specified php script relative to the document root when the requested one does not exist", uwsgi_opt_set_str, &uphp.fallback2, 0},
{"php-fallback-qs", required_argument, 0, "php-fallback with QUERY_STRING set", uwsgi_opt_set_str, &uphp.fallback_qs, 0},
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
{"php-app-bypass", required_argument, 0, "if the regexp matches the uri the --php-app is bypassed", uwsgi_opt_add_regexp_list, &uphp.app_bypass, 0},
#endif
{"php-var", required_argument, 0, "add/overwrite a CGI variable at each request", uwsgi_opt_add_string_list, &uphp.vars, 0},
@@ -810,10 +810,14 @@ int uwsgi_php_request(struct wsgi_reques
wsgi_req->document_root_len = strlen(wsgi_req->document_root);
if (uphp.app) {
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
struct uwsgi_regexp_list *bypass = uphp.app_bypass;
while (bypass) {
+#ifdef UWSGI_PCRE2
+ if (uwsgi_regexp_match(bypass->pattern, wsgi_req->uri, wsgi_req->uri_len) >= 0) {
+#else
if (uwsgi_regexp_match(bypass->pattern, bypass->pattern_extra, wsgi_req->uri, wsgi_req->uri_len) >= 0) {
+#endif
goto oldstyle;
}
bypass = bypass->next;
@@ -849,7 +853,7 @@ appready:
goto secure2;
}
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
oldstyle:
#endif
--- a/core/config.c
+++ b/core/config.c
@@ -314,7 +314,7 @@ int uwsgi_logic_opt_if_not_hostname(char
return 0;
}
-#ifdef UWSGI_PCRE
+#if defined(UWSGI_PCRE) || defined(UWSGI_PCRE2)
int uwsgi_logic_opt_if_hostname_match(char *key, char *value) {
if (uwsgi_regexp_match_pattern(uwsgi.logic_opt_data, uwsgi.hostname)) {
add_exported_option(key, uwsgi_substitute(value, "%(_)", uwsgi.logic_opt_data), 0);

View file

@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=xfrpc
PKG_VERSION:=2.6.633
PKG_VERSION:=2.9.644
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/liudf0716/xfrpc.git
PKG_SOURCE_VERSION:=$(PKG_VERSION)
PKG_MIRROR_HASH:=b9d5c2f8dd0d323169a824bb59d65bcc27fe6e0564c6aede5b966220b99ccc7b
PKG_MIRROR_HASH:=99cda337c641664d94abc3fe4e144c13a7f3191951e917e7a837ab88a7df4515
PKG_MAINTAINER:=Dengfeng Liu <liudf0716@gmail.com>
PKG_LICENSE:=GPL-3.0-or-later

View file

@ -28,7 +28,7 @@ handle_xfrpc() {
echo "local_ip = $local_ip" >> "$config"
echo "local_port = $local_port" >> "$config"
case "$type" in
tcp)
tcp|mstsc|socks5)
config_get remote_port "$name" remote_port
echo "remote_port = $remote_port" >> "$config"
;;

View file

@ -1,14 +1,14 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=compose
PKG_VERSION:=2.21.0
PKG_VERSION:=2.22.0
PKG_RELEASE:=1
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE
PKG_SOURCE:=v$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/docker/compose/tar.gz/v${PKG_VERSION}?
PKG_HASH:=0014b23382a50c90f91849e491500568366052882e22011822ca2d8a3b2976f2
PKG_HASH:=82bd4622729cff061b3489bad96b54849a7f4b462345aade1bd374c879db9019
PKG_MAINTAINER:=Javier Marcet <javier@marcet.info>

View file

@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=mg
PKG_VERSION:=7.3
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/ibara/mg/tar.gz/$(PKG_NAME)-$(PKG_VERSION)?
@ -22,7 +22,7 @@ include $(INCLUDE_DIR)/package.mk
define Package/mg
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=+libncurses +libpcre
DEPENDS:=+libncurses +libpcre2
TITLE:=microscopic EMACS style editor
URL:=https://github.com/ibara/mg
SUBMENU:=Editors

View file

@ -168,7 +168,7 @@
- ;;
-esac
+# OpenWrt
+libs='-lncurses -lpcreposix -lutil'
+libs='-lncurses -lpcre2-posix -lutil'
+cflags="$cflags -D_GNU_SOURCE -D__dead=\"__attribute__((__noreturn__))\" -Dst_mtimespec=st_mtim"
cat << EOF > config.h

View file

@ -5,7 +5,7 @@
#include <sys/queue.h>
#include <sys/types.h>
-#include <regex.h>
+#include <pcreposix.h>
+#include <pcre2posix.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>

View file

@ -6,12 +6,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=setools
PKG_VERSION:=4.4.2
PKG_VERSION:=4.4.3
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://github.com/SELinuxProject/setools/releases/download/$(PKG_VERSION)
PKG_HASH:=f23e3c8635aa289096ca0218ca6f4568a4346e088bc46f374cb0917b7fb66f05
PKG_HASH:=2f751599dbed0d628fb268a3302dd8c578829f302bd28e8c08e182aef7fd5cb8
PKG_BUILD_DEPENDS:=python-cython/host # Cython>=0.27

View file

@ -1,12 +1,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=slirp4netns
PKG_VERSION:=1.2.0
PKG_VERSION:=1.2.2
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/rootless-containers/slirp4netns/archive/v$(PKG_VERSION)
PKG_HASH:=b584edde686d3cfbac210cbdb93c4b0ba5d8cc0a6a4d92b9dfc3c5baec99c727
PKG_HASH:=2450afb5730ee86a70f9c3f0d3fbc8981ab8e147246f4e0d354f0226a3a40b36
PKG_MAINTAINER:=Oskari Rauta <oskari.rauta@gmail.com>
PKG_LICENSE:=GPL-2.0-or-later