mirror of
https://github.com/openappsec/openappsec.git
synced 2026-01-17 16:00:26 +03:00
sync code
This commit is contained in:
@@ -28,10 +28,10 @@ initAttachmentConfig(c_str conf_file)
|
||||
return conf_data.init(conf_file);
|
||||
}
|
||||
|
||||
ngx_http_inspection_mode_e
|
||||
NanoHttpInspectionMode
|
||||
getInspectionMode()
|
||||
{
|
||||
return static_cast<ngx_http_inspection_mode_e>(conf_data.getNumericalValue("nginx_inspection_mode"));
|
||||
return static_cast<NanoHttpInspectionMode>(conf_data.getNumericalValue("nginx_inspection_mode"));
|
||||
}
|
||||
|
||||
unsigned int
|
||||
@@ -191,6 +191,24 @@ getRemoveResServerHeader()
|
||||
return conf_data.getNumericalValue("remove_server_header");
|
||||
}
|
||||
|
||||
unsigned int
|
||||
getDecompressionPoolSize()
|
||||
{
|
||||
return conf_data.getNumericalValue("decompression_pool_size");
|
||||
}
|
||||
|
||||
unsigned int
|
||||
getRecompressionPoolSize()
|
||||
{
|
||||
return conf_data.getNumericalValue("recompression_pool_size");
|
||||
}
|
||||
|
||||
unsigned int
|
||||
getIsBrotliInspectionEnabled()
|
||||
{
|
||||
return conf_data.getNumericalValue("is_brotli_inspection_enabled");
|
||||
}
|
||||
|
||||
int
|
||||
isIPAddress(c_str ip_str)
|
||||
{
|
||||
@@ -285,3 +303,15 @@ isSkipSource(c_str ip_str)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
isPairedAffinityEnabled()
|
||||
{
|
||||
return conf_data.getNumericalValue("is_paired_affinity_enabled") != 0;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
isAsyncModeEnabled()
|
||||
{
|
||||
return conf_data.getNumericalValue("is_async_mode_enabled") != 0;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,12 @@ TEST_F(HttpAttachmentUtilTest, GetValidAttachmentConfiguration)
|
||||
"\"hold_verdict_retries\": 3,\n"
|
||||
"\"hold_verdict_polling_time\": 1,\n"
|
||||
"\"body_size_trigger\": 777,\n"
|
||||
"\"remove_server_header\": 1\n"
|
||||
"\"remove_server_header\": 1,\n"
|
||||
"\"decompression_pool_size\": 524288,\n"
|
||||
"\"recompression_pool_size\": 32768,\n"
|
||||
"\"is_paired_affinity_enabled\": 0,\n"
|
||||
"\"is_async_mode_enabled\": 0,\n"
|
||||
"\"is_brotli_inspection_enabled\": 1\n"
|
||||
"}\n";
|
||||
ofstream valid_configuration_file(attachment_configuration_file_name);
|
||||
valid_configuration_file << valid_configuration;
|
||||
@@ -97,10 +102,13 @@ TEST_F(HttpAttachmentUtilTest, GetValidAttachmentConfiguration)
|
||||
EXPECT_EQ(getMaxRetriesForVerdict(), 3u);
|
||||
EXPECT_EQ(getReqBodySizeTrigger(), 777u);
|
||||
EXPECT_EQ(getWaitingForVerdictThreadTimeout(), 75u);
|
||||
EXPECT_EQ(getInspectionMode(), ngx_http_inspection_mode::BLOCKING_THREAD);
|
||||
EXPECT_EQ(getInspectionMode(), NanoHttpInspectionMode::BLOCKING_THREAD);
|
||||
EXPECT_EQ(getRemoveResServerHeader(), 1u);
|
||||
EXPECT_EQ(getDecompressionPoolSize(), 524288u);
|
||||
EXPECT_EQ(getRecompressionPoolSize(), 32768u);
|
||||
EXPECT_EQ(getHoldVerdictRetries(), 3u);
|
||||
EXPECT_EQ(getHoldVerdictPollingTime(), 1u);
|
||||
EXPECT_EQ(getIsBrotliInspectionEnabled(), 1u);
|
||||
|
||||
EXPECT_EQ(isDebugContext("1.2.3.4", "5.6.7.8", 80, "GET", "test", "/abc"), 1);
|
||||
EXPECT_EQ(isDebugContext("1.2.3.9", "5.6.7.8", 80, "GET", "test", "/abc"), 0);
|
||||
@@ -125,6 +133,9 @@ TEST_F(HttpAttachmentUtilTest, GetValidAttachmentConfiguration)
|
||||
EXPECT_EQ(isSkipSource("0:0:0:0:0:0:0:4"), 1);
|
||||
EXPECT_EQ(isSkipSource("0:0:0:0:0:0:0:5"), 1);
|
||||
EXPECT_EQ(isSkipSource("0:0:0:0:0:0:0:6"), 0);
|
||||
|
||||
EXPECT_EQ(isPairedAffinityEnabled(), 0u);
|
||||
EXPECT_EQ(isAsyncModeEnabled(), 0u);
|
||||
}
|
||||
|
||||
TEST_F(HttpAttachmentUtilTest, CheckIPAddrValidity)
|
||||
|
||||
Reference in New Issue
Block a user