File: 0003-PCRE2-support-added.patch

package info (click to toggle)
libnginx-mod-http-subs-filter 1%3A0.6.4-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 800 kB
  • sloc: perl: 6,644; ansic: 921; sh: 57; makefile: 3
file content (30 lines) | stat: -rw-r--r-- 1,163 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From cc494d7f5c5273a7a8ae503faebf1101689d75c0 Mon Sep 17 00:00:00 2001
From: shmux8 <75251845+shmux8@users.noreply.github.com>
Date: Tue, 28 Dec 2021 11:15:00 +0300
Subject: [PATCH] PCRE2 support added
Origin: https://github.com/yaoweibin/ngx_http_substitutions_filter_module/commit/cc494d7f5c5273a7a8ae503faebf1101689d75c0
Forwarded: not-needed

Use pcre2_pattern_info call if nginx built with PCRE2.
---
 ngx_http_subs_filter_module.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ngx_http_subs_filter_module.c b/ngx_http_subs_filter_module.c
index bb48e9d..13355bf 100644
--- a/ngx_http_subs_filter_module.c
+++ b/ngx_http_subs_filter_module.c
@@ -1248,7 +1248,9 @@ ngx_http_subs_regex_capture_count(ngx_regex_t *re)
 
     n = 0;
 
-#if defined(nginx_version) && nginx_version >= 1002002
+#if (NGX_PCRE2)
+    rc = pcre2_pattern_info(re, PCRE2_INFO_CAPTURECOUNT, &n);
+#elif defined(nginx_version) && nginx_version >= 1002002
     rc = pcre_fullinfo(re->code, NULL, PCRE_INFO_CAPTURECOUNT, &n);
 #elif defined(nginx_version) && nginx_version >= 1001012
     rc = pcre_fullinfo(re->pcre, NULL, PCRE_INFO_CAPTURECOUNT, &n);
-- 
2.30.2