Commit 75b25921 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

param: Introduce the notion of PCRE parameters

Unlike string or VCC parameters they are inherited, but their definition
is not as straightforward as simple parameters. They also need to be
guarded by PARAM_ALL because inside struct params they are groupped in a
dedicated struct vre_limits, and there is no need for disruption in that
area.

Refs #3250
parent 17b53dbe
......@@ -34,39 +34,11 @@
#include <stdio.h>
#include "mgt/mgt.h"
#include "mgt/mgt_param.h"
struct parspec mgt_parspec[] = {
#define PARAM_ALL
#define PARAM(ty, nm, ...) { #nm, __VA_ARGS__ },
#include "tbl/params.h"
{ "pcre_match_limit", tweak_uint,
&mgt_param.vre_limits.match,
"1", NULL, "10000",
NULL,
"The limit for the number of calls to the internal match()"
" function in pcre_exec().\n\n"
"(See: PCRE_EXTRA_MATCH_LIMIT in pcre docs.)\n\n"
"This parameter limits how much CPU time"
" regular expression matching can soak up." },
{ "pcre_match_limit_recursion", tweak_uint,
&mgt_param.vre_limits.match_recursion,
"1", NULL, "20",
NULL,
"The recursion depth-limit for the internal match() function"
" in a pcre_exec().\n\n"
"(See: PCRE_EXTRA_MATCH_LIMIT_RECURSION in pcre docs.)\n\n"
"This puts an upper limit on the amount of stack used"
" by PCRE for certain classes of regular expressions.\n\n"
"We have set the default value low in order to"
" prevent crashes, at the cost of possible regexp"
" matching failures.\n\n"
"Matching failures will show up in the log as VCL_Error"
" messages with regexp errors -27 or -21.\n\n"
"Testcase r01576 can be useful when tuning this parameter." },
{ NULL, NULL, NULL }
};
......@@ -1349,7 +1349,48 @@ PARAM_VCC(
"Allow 'import ... from ...'."
)
/*--------------------------------------------------------------------
* PCRE parameters
*/
# define PARAM_PCRE(nm, pv, min, def, descr) \
PARAM(, nm, tweak_uint, &mgt_param.vre_limits.pv, \
min, NULL, def, NULL, descr)
PARAM_PCRE(
/* name */ pcre_match_limit,
/* priv */ match,
/* min */ "1",
/* def */ "10000",
/* descr */
"The limit for the number of calls to the internal match()"
" function in pcre_exec().\n\n"
"(See: PCRE_EXTRA_MATCH_LIMIT in pcre docs.)\n\n"
"This parameter limits how much CPU time"
" regular expression matching can soak up."
)
PARAM_PCRE(
/* name */ pcre_match_limit_recursion,
/* priv */ match_recursion,
/* min */ "1",
/* def */ "20",
/* descr */
"The recursion depth-limit for the internal match() function"
" in a pcre_exec().\n\n"
"(See: PCRE_EXTRA_MATCH_LIMIT_RECURSION in pcre docs.)\n\n"
"This puts an upper limit on the amount of stack used"
" by PCRE for certain classes of regular expressions.\n\n"
"We have set the default value low in order to"
" prevent crashes, at the cost of possible regexp"
" matching failures.\n\n"
"Matching failures will show up in the log as VCL_Error"
" messages with regexp errors -27 or -21.\n\n"
"Testcase r01576 can be useful when tuning this parameter."
)
# undef PARAM_ALL
# undef PARAM_PCRE
# undef PARAM_STRING
# undef PARAM_VCC
#endif /* defined(PARAM_ALL) */
......@@ -1408,32 +1449,6 @@ PARAM(
" esi_remove_bom Remove UTF-8 BOM"
)
/* actual location mgt_param_tbl.c */
PARAM(
/* name */ pcre_match_limit,
/* type */ uint,
/* min */ "1",
/* max */ NULL,
/* def */ "1.000",
/* units */ NULL,
/* descr */
"The limit for the number of internal matching function calls in "
"a pcre_exec() execution."
)
/* actual location mgt_param_tbl.c */
PARAM(
/* name */ pcre_match_limit_recursion,
/* type */ uint,
/* min */ "1",
/* max */ NULL,
/* def */ "1.000",
/* units */ NULL,
/* descr */
"The limit for the number of internal matching function "
"recursions in a pcre_exec() execution."
)
/* actual location mgt_pool.c */
PARAM(
/* name */ thread_pool_add_delay,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment