From 1c0ed192dba0568a8d19051bf4a34ff39ebaaa24 Mon Sep 17 00:00:00 2001 From: brenosilva Date: Sat, 22 Oct 2011 18:38:13 +0000 Subject: [PATCH] Add pcre JIT support - experimental --- apache2/msc_pcre.c | 6 +++++- configure.ac | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/apache2/msc_pcre.c b/apache2/msc_pcre.c index 2faaf590..8ca588a9 100644 --- a/apache2/msc_pcre.c +++ b/apache2/msc_pcre.c @@ -62,7 +62,11 @@ void *msc_pregcomp_ex(apr_pool_t *pool, const char *pattern, int options, if (regex->re == NULL) return NULL; #ifdef WITH_PCRE_STUDY - pe = pcre_study(regex->re, 0, &errptr); + #ifdef WITH_PCRE_JIT + pe = pcre_study(regex->re, PCRE_STUDY_JIT_COMPILE, &errptr); + #else + pe = pcre_study(regex->re, 0, &errptr); + #endif #endif /* Setup the pcre_extra record if pcre_study did not already do it */ diff --git a/configure.ac b/configure.ac index 705a3d51..ef2210a2 100644 --- a/configure.ac +++ b/configure.ac @@ -250,6 +250,24 @@ AC_ARG_ENABLE(pcre-study, pcre_study='-DWITH_PCRE_STUDY' ]) +# Add PCRE JIT + +AC_ARG_ENABLE(pcre-jit, + AS_HELP_STRING([--enable-pcre-jit], + [Enable PCRE regex jit support during configure.]), +[ + if test "$enableval" != "no"; then + pcre_jit='-DWITH_PCRE_JIT' + MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $pcre_jit" + else + pcre_jit='' + fi +], +[ + pcre_jit='' +]) + + # Limit PCRE matching AC_ARG_ENABLE(pcre-match-limit, AS_HELP_STRING([--enable-pcre-match-limit],