Skip to content

Commit a368ed6

Browse files
authored
Merge pull request #5 from Fabian123333/filter-per-domain-handling
Filter per domain handling
2 parents 642cdca + 30f2ed3 commit a368ed6

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

anti_ddos_worker.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ class AntiDDoSWorker{
6868
score += Config::FiltersPostRequest().Get(i).GetScore(r);
6969
}
7070

71+
if(worker.CheckIfIsBlocked(r->connection->client_ip)){
72+
r->status = 429;
73+
ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,
74+
"detect blocked access, too many requests: %s", r->connection->client_ip);
75+
76+
return OK;
77+
}
78+
7179
for(int i = 0; i < Config::DomainFiltersPostRequest(r->hostname).Count(); i++){
7280
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
7381
"detect filters for domain from postrequest (%s)", r->hostname);

config.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Config{
4949

5050
static char* SetRedisPath(cmd_parms *cmd, void *cfg, const char *arg){
5151
redisUrl = (char*)malloc(strlen(arg) + 1);
52-
strcpy(configPath, arg);
52+
strcpy(redisUrl, arg);
5353
return NULL;
5454
}
5555

@@ -60,7 +60,7 @@ class Config{
6060
}
6161

6262
static char* SetRedisConnectionType(cmd_parms *cmd, void *cfg, const char *arg){
63-
if(strcmp(arg, "unix"))
63+
if(strcmp(arg, "unix") || strcmp(arg, "UNIX") )
6464
redisProtocol = AF_UNIX;
6565
redisProtocol = AF_INET;
6666
return NULL;

0 commit comments

Comments
 (0)