Opened 6 years ago

Closed 6 years ago

#1664 closed defect (invalid)

sub_filter not PCRE compliant

Reported by: jgibart@… Owned by:
Priority: major Milestone:
Component: nginx-module Version: 1.15.x
Keywords: ngx_http_sub_filter_module.c Cc:
uname -a: CYGWIN_NT-10.0 L-CND42883QG 2.11.1(0.329/5/3) 2018-09-05 10:24 x86_64 Cygwin
nginx -V: nginx version: nginx/1.15.4
built by cl 16.00.40219.01 for 80x86
built with OpenSSL 1.0.2p 14 Aug 2018
TLS SNI support enabled
configure arguments: --with-cc=cl --builddir=objs.msvc8 --with-debug --prefix= --conf-path=conf/nginx.conf --pid-path=logs/nginx.pid --http-log-path=logs/access.log --error-log-path=logs/error.log --sbin-path=nginx.exe --http-client-body-temp-path=temp/client_body_temp --http-proxy-temp-path=temp/proxy_temp --http-fastcgi-temp-path=temp/fastcgi_temp --http-scgi-temp-path=temp/scgi_temp --http-uwsgi-temp-path=temp/uwsgi_temp --with-cc-opt=-DFD_SETSIZE=1024 --with-pcre=objs.msvc8/lib/pcre-8.42 --with-zlib=objs.msvc8/lib/zlib-1.2.11 --with-select_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_slice_module --with-mail --with-stream --with-openssl=objs.msvc8/lib/openssl-1.0.2p --with-openssl-opt=no-asm --with-http_ssl_module --with-mail_ssl_module --with-stream_ssl_module

Description

I was struggling with sub_filter directives to translate pages links and I was surprised that this rule was not working

sub_filter "src=(['\"])(\.\./){1,}/images/" "src=$1root/images/";

Simplifying my expressions I saw all rules using [] were not working. Same for rules using quantifiers {min,max}.

Even a basic [a-z] match didnt work as expected.

sub_filter "[a-z]" "?";

didnt work.

sub_filter "a" "?";

was working

Litterals such as \x<hex value> \0<octal> \x{hex} didnt work either

Is this feature using really PCRE ? Or does it have a really reduced subset of PCRE.

Thank for your inputs.

Change History (1)

comment:1 by Maxim Dounin, 6 years ago

Resolution: invalid
Status: newclosed

See the documentation, the sub_filter directive allows replacing one specified string by another. It does not support neither PCRE, nor other variants of regular expressions.

Note: See TracTickets for help on using tickets.