mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
perf. improvement/rx: Only compute dynamic regex in case of macro
On #1528 was added the support for macro expansion on @rx operator. The performance improvement suggested on the pull request was not thread safe, therefore removed. This patch adds a performance improvement on top of #1528. The benchmarks points to 10x faster results on OWASP CRS.
This commit is contained in:
@@ -3,5 +3,3 @@ Include "../../modsecurity.conf-recommended"
|
||||
|
||||
Include "owasp-v3/crs-setup.conf.example"
|
||||
Include "owasp-v3/rules/*.conf"
|
||||
Include "owasp-v3/crs-setup.conf.example"
|
||||
Include "owasp-v3/rules/*.conf"
|
||||
|
@@ -24,31 +24,8 @@
|
||||
|
||||
using modsecurity::Transaction;
|
||||
|
||||
char request_header[] = "" \
|
||||
"GET /tutorials/other/top-20-mysql-best-practices/ HTTP/1.1\n\r" \
|
||||
"Host: net.tutsplus.com\n\r" \
|
||||
"User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5)" \
|
||||
" Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)\n\r" \
|
||||
"Accept: text/html,application/xhtml+xml,application/xml; " \
|
||||
"q=0.9,*/*;q=0.8\n\r" \
|
||||
"Accept-Language: en-us,en;q=0.5\n\r" \
|
||||
"Accept-Encoding: gzip,deflate\n\r" \
|
||||
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\n\r" \
|
||||
"Keep-Alive: 300\n\r" \
|
||||
"Connection: keep-alive\n\r" \
|
||||
"Cookie: PHPSESSID=r2t5uvjq435r4q7ib3vtdjq120\n\r" \
|
||||
"Pragma: no-cache\n\r" \
|
||||
"Cache-Control: no-cache\n\r";
|
||||
|
||||
char request_uri[] = "/test.pl?param1=test¶2=test2";
|
||||
|
||||
char request_body[] = "";
|
||||
|
||||
char response_headers[] = "" \
|
||||
"HTTP/1.1 200 OK\n\r" \
|
||||
"Content-Type: text/xml; charset=utf-8\n\r" \
|
||||
"Content-Length: length\n\r";
|
||||
|
||||
unsigned char response_body[] = "" \
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\r" \
|
||||
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " \
|
||||
@@ -69,7 +46,7 @@ const char* const help_message = "Usage: benchmark [num_iterations|-h|-?|--help]
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
unsigned long long NUM_REQUESTS(10000);
|
||||
unsigned long long NUM_REQUESTS(1000000);
|
||||
|
||||
if (argc > 1) {
|
||||
if (0 == strcmp(argv[1], "-h") ||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
git clone https://github.com/SpiderLabs/owasp-modsecurity-crs.git owasp-v3
|
||||
cd owasp-v3
|
||||
git checkout v3.0.0 -b tag3.0.0
|
||||
git checkout v3.0.2 -b tag3.0.2
|
||||
cd -
|
||||
|
||||
echo 'Include "owasp-v3/crs-setup.conf.example"' >> basic_rules.conf
|
||||
|
Reference in New Issue
Block a user