mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Coding style fixes
This commit is contained in:
@@ -13,10 +13,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#define NUM_THREADS 100
|
||||
|
||||
@@ -151,8 +152,9 @@ class ReadingLogsViaRuleMessage {
|
||||
dms.rules = rules;
|
||||
|
||||
for (i = 0; i < NUM_THREADS; i++) {
|
||||
pthread_create(&threads[i], NULL, process_request, (void *)&dms);
|
||||
//process_request((void *)&dms);
|
||||
pthread_create(&threads[i], NULL, process_request,
|
||||
reinterpret_cast<void *>(&dms));
|
||||
// process_request((void *)&dms);
|
||||
}
|
||||
|
||||
usleep(10000);
|
||||
|
@@ -23,14 +23,13 @@
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
*argv++;
|
||||
if (*argv == NULL) {
|
||||
*argv--;
|
||||
if (argc < 2) {
|
||||
std::cout << "Use " << *argv << " test-case-file.conf";
|
||||
std::cout << std::endl << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
*(argv++);
|
||||
std::string rules(*argv);
|
||||
ReadingLogsViaRuleMessage rlvrm(request_header, request_uri, request_body,
|
||||
response_headers, response_body, ip, rules);
|
||||
|
@@ -35,14 +35,11 @@ SecRule REQUEST_HEADERS:Content-Type "application/json" \
|
||||
# to the size of data, with files excluded. You want to keep that value as
|
||||
# low as practical.
|
||||
#
|
||||
SecRequestBodyLimit 13107200
|
||||
SecRequestBodyNoFilesLimit 131072
|
||||
|
||||
# Store up to 128 KB of request body data in memory. When the multipart
|
||||
# parser reachers this limit, it will start using your hard disk for
|
||||
# storage. That is slow, but unavoidable.
|
||||
#
|
||||
SecRequestBodyInMemoryLimit 131072
|
||||
|
||||
# What do do if the request body size is above our configured limit.
|
||||
# Keep in mind that this setting will automatically be set to ProcessPartial
|
||||
|
@@ -13,18 +13,20 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <modsecurity/modsecurity.h>
|
||||
#include <modsecurity/rules.h>
|
||||
#include <modsecurity/rule_message.h>
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
|
||||
|
||||
char request_uri[] = "/test.pl?param1=test¶2=test2";
|
||||
|
||||
@@ -85,8 +87,7 @@ static void logCb(void *data, const void *ruleMessagev) {
|
||||
}
|
||||
}
|
||||
|
||||
int process_intervention(modsecurity::Transaction *transaction)
|
||||
{
|
||||
int process_intervention(modsecurity::Transaction *transaction) {
|
||||
modsecurity::ModSecurityIntervention intervention;
|
||||
intervention.status = 200;
|
||||
intervention.url = NULL;
|
||||
@@ -105,8 +106,7 @@ int process_intervention(modsecurity::Transaction *transaction)
|
||||
free(intervention.log);
|
||||
intervention.log = NULL;
|
||||
|
||||
if (intervention.url != NULL)
|
||||
{
|
||||
if (intervention.url != NULL) {
|
||||
std::cout << "Intervention, redirect to: " << intervention.url;
|
||||
std::cout << " with status code: " << intervention.status << std::endl;
|
||||
free(intervention.url);
|
||||
@@ -114,8 +114,7 @@ int process_intervention(modsecurity::Transaction *transaction)
|
||||
return intervention.status;
|
||||
}
|
||||
|
||||
if (intervention.status != 200)
|
||||
{
|
||||
if (intervention.status != 200) {
|
||||
std::cout << "Intervention, returning code: " << intervention.status;
|
||||
std::cout << std::endl;
|
||||
return intervention.status;
|
||||
@@ -129,13 +128,12 @@ int main(int argc, char **argv) {
|
||||
modsecurity::Rules *rules;
|
||||
modsecurity::ModSecurityIntervention it;
|
||||
|
||||
*argv++;
|
||||
if (*argv == NULL) {
|
||||
*argv--;
|
||||
if (argc < 2) {
|
||||
std::cout << "Use " << *argv << " test-case-file.conf";
|
||||
std::cout << std::endl << std::endl;
|
||||
return -1;
|
||||
}
|
||||
*(argv++);
|
||||
|
||||
std::string rules_arg(*argv);
|
||||
|
||||
|
Reference in New Issue
Block a user