aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_regex.c
Commit message (Collapse)AuthorAge
* Core: fixed memory leak on configuration reload with PCRE2.Maxim Dounin2023-10-17
| | | | | | | | | | | | | | | | In ngx_regex_cleanup() allocator wasn't configured when calling pcre2_compile_context_free() and pcre2_match_data_free(), resulting in no ngx_free() call and leaked memory. Fix is ensure that allocator is configured for global allocations, so that ngx_free() is actually called to free memory. Additionally, ngx_regex_compile_context was cleared in ngx_regex_module_init(). It should be either not cleared, so it will be freed by ngx_regex_cleanup(), or properly freed. Fix is to not clear it, so ngx_regex_cleanup() will be able to free it. Reported by ZhenZhong Wu, https://mailman.nginx.org/pipermail/nginx-devel/2023-September/3Z5FIKUDRN2WBSL3JWTZJ7SXDA6YIWPB.html
* Fixed segfault if regex studies list allocation fails.Maxim Dounin2023-04-18
| | | | | | The rcf->studies list is unconditionally accessed by ngx_regex_cleanup(), and this used to cause NULL pointer dereference if allocation failed. Fix is to set cleanup handler only when allocation succeeds.
* Core: added NGX_REGEX_MULTILINE for 3rd party modules.Maxim Dounin2021-12-25
| | | | | | | | Notably, NAXSI is known to misuse ngx_regex_compile() with rc.options set to PCRE_CASELESS | PCRE_MULTILINE. With PCRE2 support, and notably binary compatibility changes, it is no longer possible to set PCRE[2]_MULTILINE option without using proper interface. To facilitate correct usage, this change adds the NGX_REGEX_MULTILINE option.
* PCRE2 and PCRE binary compatibility.Maxim Dounin2021-12-25
| | | | | | | | | | With this change, dynamic modules using nginx regex interface can be used regardless of the variant of the PCRE library nginx was compiled with. If a module is compiled with different PCRE library variant, in case of ngx_regex_exec() errors it will report wrong function name in error messages. This is believed to be tolerable, given that fixing this will require interface changes.
* PCRE2 library support.Maxim Dounin2021-12-25
| | | | | | | | | | | | | | | | | | | | | | | The PCRE2 library is now used by default if found, instead of the original PCRE library. If needed for some reason, this can be disabled with the --without-pcre2 configure option. To make it possible to specify paths to the library and include files via --with-cc-opt / --with-ld-opt, the library is first tested without any additional paths and options. If this fails, the pcre2-config script is used. Similarly to the original PCRE library, it is now possible to build PCRE2 from sources with nginx configure, by using the --with-pcre= option. It automatically detects if PCRE or PCRE2 sources are provided. Note that compiling PCRE2 10.33 and later requires inttypes.h. When compiling on Windows with MSVC, inttypes.h is only available starting with MSVC 2013. In older versions some replacement needs to be provided ("echo '#include <stdint.h>' > pcre2-10.xx/src/inttypes.h" is good enough for MSVC 2010). The interface on nginx side remains unchanged.
* Core: ngx_regex.c style cleanup.Maxim Dounin2021-12-25
| | | | | Notably, ngx_pcre_pool and ngx_pcre_studies are renamed to ngx_regex_pool and ngx_regex_studies, respectively.
* Core: fixed ngx_pcre_studies cleanup.Maxim Dounin2021-12-25
| | | | | | | | | | | | If a configuration parsing fails for some reason, ngx_regex_module_init() is not called, and ngx_pcre_studies remained set despite the fact that the pool it was allocated from is already freed. This might result in a segmentation fault during runtime regular expression compilation, such as in SSI, for example, in the single process mode, or if a worker process died and was respawned from a master process in such an inconsistent state. Fix is to clear ngx_pcre_studies from the pool cleanup handler (which is anyway used to free JIT-compiled patterns).
* Style.Maxim Dounin2017-08-10
|
* Fixed NGX_CONF_TAKE1/NGX_CONF_FLAG misuse (as in e444e8f6538b).Ruslan Ermilov2016-04-12
|
* Removed ngx_threaded and related code.Ruslan Ermilov2015-03-26
|
* Renamed NGX_THREADS to NGX_OLD_THREADS because of deprecation.Ruslan Ermilov2015-03-04
| | | | It's mostly dead code and the original idea of worker threads has been rejected.
* Core: ngx_regex_compile() error handling fixes.Maxim Dounin2014-09-08
| | | | | | | Now we actually return NGX_ERROR on errors, and provide an error string for memory allocation errors. Reported by Markus Linnala.
* Fixed the ngx_regex.h header file compatibility with C++.Valentin Bartenev2012-05-17
|
* Fixed memory leak on HUP signal when PCRE JIT was used.Valentin Bartenev2012-01-30
| | | | | The PCRE JIT compiler uses mmap to allocate memory for its executable codes, so we have to explicitly call the pcre_free_study() function to free this memory.
* Fixed grammar in PCRE JIT error log message.Valentin Bartenev2012-01-24
|
* Copyright updated.Maxim Konovalov2012-01-18
|
* Added support for regex study and PCRE JIT (ticket #41) optimizations onValentin Bartenev2011-12-26
| | | | configuration phase.
* Removed unused function ngx_regex_capture_count().Valentin Bartenev2011-12-06
| | | | The function has been unused since r3326.
* fix pcre allocation on Win32, the bug had been introduced in r3326Igor Sysoev2009-11-17
|
* regex named capturesIgor Sysoev2009-11-16
|
* ngx_regex_exec() calling optimiztion:Igor Sysoev2009-11-13
| | | | | | *) change NGX_REGEX_NO_MATCHED to PCRE_ERROR_NOMATCH *) declare ngx_regex_exec() as #define *) optimize SSI regex a little
* *) back out r2040Igor Sysoev2008-06-17
| | | | | | *) refactor ngx_palloc() *) introduce ngx_pnalloc() *) additional pool blocks have smaller header
* *) add ngx_palloc_aligned() to allocate explicitlty aligned memoryIgor Sysoev2008-05-27
| | | | | | *) allows non-aligned memory blocks for small allocations and for odd length strings on all platforms *) use ngx_palloc_aligned()
* ngx_regex_exec_array()Igor Sysoev2007-12-27
|
* nginx-0.1.26-RELEASE importrelease-0.1.26Igor Sysoev2005-03-22
| | | | | | | | | | *) Change: the invalid client header lines are now ignored and logged at the info level. *) Change: the server name is also logged in error log. *) Feature: the ngx_http_auth_basic_module module and the auth_basic and auth_basic_user_file directives.
* nginx-0.1.25-RELEASE importrelease-0.1.25Igor Sysoev2005-03-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | *) Bugfix: nginx did run on Linux parisc. *) Feature: nginx now does not start under FreeBSD if the sysctl kern.ipc.somaxconn value is too big. *) Bugfix: if a request was internally redirected by the ngx_http_index_module module to the ngx_http_proxy_module or ngx_http_fastcgi_module modules, then the index file was not closed after request completion. *) Feature: the "proxy_pass" can be used in location with regular expression. *) Feature: the ngx_http_rewrite_filter_module module supports the condition like "if ($HTTP_USER_AGENT ~ MSIE)". *) Bugfix: nginx started too slow if the large number of addresses and text values were used in the "geo" directive. *) Change: a variable name must be declared as "$name" in the "geo" directive. The previous variant without "$" is still supported, but will be removed soon. *) Feature: the "%{VARIABLE}v" logging parameter. *) Feature: the "set $name value" directive. *) Bugfix: gcc 4.0 compatibility. *) Feature: the --with-openssl-opt=OPTIONS autoconfiguration directive.
* nginx-0.1.24-RELEASE importrelease-0.1.24Igor Sysoev2005-03-04
| | | | | | | | | | | | | | | *) Feature: the ngx_http_ssi_filter_module supports the QUERY_STRING and DOCUMENT_URI variables. *) Bugfix: the ngx_http_autoindex_module may some times return the 404 response for existent directory, if this directory was used in "alias" directive. *) Bugfix: the ngx_http_ssi_filter_module ran incorrectly for large responses. *) Bugfix: the lack of the "Referer" header line was always accounted as valid referrer.
* nginx-0.1.15-RELEASE importrelease-0.1.15Igor Sysoev2005-01-19
| | | | | | | | | | | | | | | | | | | | | | | | | | *) Bugfix: the error while the connecting to the FastCGI server caused segmentation fault. *) Bugfix: the correct handling of the regular expression, that has different number of the captures and substitutions. *) Feature: the location, that is passed to the FastCGI server, can be regular expression. *) Bugfix: the FastCGI's parameter REQUEST_URI is now passed with the arguments and in the original state. *) Bugfix: the ngx_http_rewrite_module module was required to be built to use the regular expressions in locations. *) Bugfix: the directive "proxy_preserve_host on" adds port 80 to the "Host" headers, if upstream listen on port 80; the bug had appeared in 0.1.14. *) Bugfix: the same paths in autoconfiguration parameters --http-client-body-temp-path=PATH and --http-proxy-temp-path=PATH, or --http-client-body-temp-path=PATH and --http-fastcgi-temp-path=PATH caused segmentation fault.
* nginx-0.1.14-RELEASE importrelease-0.1.14Igor Sysoev2005-01-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | *) Feature: the autoconfiguration directives: --http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and --http-fastcgi-temp-path=PATH *) Change: the directory name for the temporary files with the client request body is specified by directive client_body_temp_path, by default it is <prefix>/client_body_temp. *) Feature: the ngx_http_fastcgi_module and the directives: fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params, fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout, fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers, fastcgi_busy_buffers_size, fastcgi_temp_path, fastcgi_max_temp_file_size, fastcgi_temp_file_write_size, fastcgi_next_upstream, and fastcgi_x_powered_by. *) Bugfix: the "[alert] zero size buf" error; the bug had appeared in 0.1.3. *) Change: the URI must be specified after the host name in the proxy_pass directive. *) Change: the %3F symbol in the URI was considered as the argument string start. *) Feature: the unix domain sockets support in the ngx_http_proxy_module. *) Feature: the ssl_engine and ssl_ciphers directives. Thanks to Sergey Skvortsov for SSL-accelerator.
* nginx-0.1.5-RELEASE importrelease-0.1.5Igor Sysoev2004-11-11
| | | | | | | | | | | | | | | | | | | | | | | | *) Bugfix: on Solaris and Linux there may be too many "recvmsg() returned not enough data" alerts. *) Bugfix: there were the "writev() failed (22: Invalid argument)" errors on Solaris in proxy mode without sendfile. On other platforms that do not support sendfile at all the process got caught in an endless loop. *) Bugfix: segmentation fault on Solaris in proxy mode and using sendfile. *) Bugfix: segmentation fault on Solaris. *) Bugfix: on-line upgrade did not work on Linux. *) Bugfix: the ngx_http_autoindex_module module did not escape the spaces, the quotes, and the percent signs in the directory listing. *) Change: the decrease of the copy operations. *) Feature: the userid_p3p directive.
* nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyrightIgor Sysoev2004-09-29
|
* nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused filesIgor Sysoev2004-09-28
|
* nginx-0.0.7-2004-07-07-19:01:00 importIgor Sysoev2004-07-07
|
* nginx-0.0.3-2004-03-23-09:01:52 importIgor Sysoev2004-03-23
|
* nginx-0.0.2-2004-03-16-10:10:12 importIgor Sysoev2004-03-16
|
* nginx-0.0.1-2003-12-25-23:26:58 importIgor Sysoev2003-12-25
|
* nginx-0.0.1-2003-12-08-23:48:12 importIgor Sysoev2003-12-08
|
* nginx-0.0.1-2003-11-25-23:44:56 importIgor Sysoev2003-11-25