添加windows1251编码测试用例
This commit is contained in:
@@ -1275,7 +1275,33 @@
|
|||||||
"not_flag":0
|
"not_flag":0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"compile_id": 164,
|
||||||
|
"service": 1,
|
||||||
|
"action": 1,
|
||||||
|
"do_blacklist": 1,
|
||||||
|
"do_log": 1,
|
||||||
|
"user_region": "CharsetWindows1251",
|
||||||
|
"is_valid": "yes",
|
||||||
|
"groups": [
|
||||||
|
{
|
||||||
|
"group_name": "Untitled",
|
||||||
|
"regions": [
|
||||||
|
{
|
||||||
|
"table_name": "KEYWORDS_TABLE",
|
||||||
|
"table_type": "string",
|
||||||
|
"table_content": {
|
||||||
|
"keywords": ">ЗАО\\b«Севергазвтоматика\\bАйС»<",
|
||||||
|
"expr_type": "none",
|
||||||
|
"match_method": "sub",
|
||||||
|
"format": "uncase plain"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"plugin_table": [
|
"plugin_table": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
1 GROUP group --
|
1 GROUP group --
|
||||||
2 HTTP_URL expr UTF8 GBK/BIG5/UNICODE/UTF8/url_encode_gb2312/url_encode_utf8 yes 128 quickoff
|
2 HTTP_URL expr UTF8 GBK/BIG5/UNICODE/UTF8/url_encode_gb2312/url_encode_utf8 yes 128 quickoff
|
||||||
2 HTTP_HOST expr UTF8 GBK/BIG5/UNICODE/UTF8/url_encode_gb2312/url_encode_utf8 yes 128 quickoff
|
2 HTTP_HOST expr UTF8 GBK/BIG5/UNICODE/UTF8/url_encode_gb2312/url_encode_utf8 yes 128 quickoff
|
||||||
3 KEYWORDS_TABLE expr UTF8 GBK/BIG5/UNICODE/UTF8/unicode_ascii_esc/unicode_ascii_aligned/unicode_ncr_dec/unicode_ncr_hex yes 0
|
3 KEYWORDS_TABLE expr UTF8 GBK/BIG5/UNICODE/UTF8/unicode_ascii_esc/unicode_ascii_aligned/unicode_ncr_dec/unicode_ncr_hex/windows-1251 yes 0
|
||||||
4 IP_CONFIG ip --
|
4 IP_CONFIG ip --
|
||||||
5 CONTENT_SIZE intval --
|
5 CONTENT_SIZE intval --
|
||||||
6 QD_ENTRY_INFO plugin 4 --
|
6 QD_ENTRY_INFO plugin 4 --
|
||||||
|
|||||||
@@ -377,6 +377,7 @@ TEST(StringScan, ExprPlus)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST(StringScan, ExprPlusWithOffset)
|
TEST(StringScan, ExprPlusWithOffset)
|
||||||
{
|
{
|
||||||
int ret=0, table_id=0;
|
int ret=0, table_id=0;
|
||||||
@@ -653,6 +654,54 @@ TEST(NOTLogic, OneRegion)
|
|||||||
Maat_clean_status(&mid);
|
Maat_clean_status(&mid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(StringScan, CharsetWindows1251)
|
||||||
|
{
|
||||||
|
int table_id=0,ret=0;
|
||||||
|
int read_size=0,pass_flag=0;
|
||||||
|
struct Maat_rule_t result[4];
|
||||||
|
scan_status_t mid=NULL;
|
||||||
|
//const char* fn="./testdata/mesa_logo.jpg";
|
||||||
|
const char* table_name="KEYWORDS_TABLE";
|
||||||
|
const char* fn="./testdata/charsetWindows1251.txt";
|
||||||
|
FILE* fp=fopen(fn,"r");
|
||||||
|
ASSERT_FALSE(fp==NULL);
|
||||||
|
|
||||||
|
char scan_data[4096]={0};
|
||||||
|
table_id=Maat_table_register(g_feather,table_name);
|
||||||
|
ASSERT_GT(table_id, 0);
|
||||||
|
|
||||||
|
|
||||||
|
struct Maat_hit_detail_t *hit_detail=(struct Maat_hit_detail_t *)malloc(sizeof(struct Maat_hit_detail_t)*10);
|
||||||
|
stream_para_t sp=Maat_stream_scan_string_start(g_feather,table_id,0);
|
||||||
|
int detail_ret=0;
|
||||||
|
|
||||||
|
ASSERT_FALSE(sp==NULL);
|
||||||
|
|
||||||
|
while(0==feof(fp))
|
||||||
|
{
|
||||||
|
read_size=fread(scan_data,1,sizeof(scan_data),fp);
|
||||||
|
ret=Maat_stream_scan_string_detail(&sp,CHARSET_NONE,scan_data,read_size
|
||||||
|
,result,4,hit_detail,10
|
||||||
|
,&detail_ret,&mid);
|
||||||
|
if(ret>0)
|
||||||
|
{
|
||||||
|
pass_flag=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EXPECT_EQ(pass_flag, 1);
|
||||||
|
EXPECT_EQ(result[0].config_id, 164);
|
||||||
|
|
||||||
|
Maat_stream_scan_string_end(&sp);
|
||||||
|
free(hit_detail);
|
||||||
|
fclose(fp);
|
||||||
|
Maat_clean_status(&mid);
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST(NOTLogic, ScanNotAtLast)
|
TEST(NOTLogic, ScanNotAtLast)
|
||||||
{
|
{
|
||||||
const char* string_should_hit="This string ONLY contains must-contained-string-of-rule-144.";
|
const char* string_should_hit="This string ONLY contains must-contained-string-of-rule-144.";
|
||||||
|
|||||||
48
test/testdata/charsetWindows1251.txt
vendored
Normal file
48
test/testdata/charsetWindows1251.txt
vendored
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','JS_CORE_WINDOW_AUTH':'<27><><EFBFBD><EFBFBD><EFBFBD>','JS_CORE_IMAGE_FULL':'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'});</script>
|
||||||
|
<script type="text/javascript">(window.BX||top.BX).message({'LANGUAGE_ID':'ru','FORMAT_DATE':'DD.MM.YYYY','FORMAT_DATETIME':'DD.MM.YYYY HH:MI:SS','COOKIE_PREFIX':'BITRIX_SM','USER_ID':'','SERVER_TIME':'1578340589','SERVER_TZ_OFFSET':'18000','USER_TZ_OFFSET':'0','USER_TZ_AUTO':'Y','bitrix_sessid':'fadf964e9f5bb819f212e5abf5ffb255','SITE_ID':'s1'});</script>
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript" src="/bitrix/cache/js/s1/web20/kernel_main/kernel_main.js?1402043622360126"></script>
|
||||||
|
<script type="text/javascript" src="/bitrix/js/main/rsasecurity.js?136876011925044"></script>
|
||||||
|
<script type="text/javascript">BX.setCSSList(['/bitrix/js/main/core/css/core.css','/bitrix/js/main/core/css/core_popup.css','/bitrix/js/main/core/css/core_date.css','/bitrix/js/main/core/css/core.css','/bitrix/js/main/core/css/core_popup.css','/bitrix/js/main/core/css/core_date.css']); </script>
|
||||||
|
<script type="text/javascript">BX.setJSList(['/bitrix/js/main/core/core.js','/bitrix/js/main/core/core_ajax.js','/bitrix/js/main/session.js','/bitrix/js/main/json/json2.min.js','/bitrix/js/main/core/core_ls.js','/bitrix/js/main/core/core_window.js','/bitrix/js/main/utils.js','/bitrix/js/main/core/core_popup.js','/bitrix/js/main/core/core_date.js','/bitrix/js/main/dd.js']); </script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
bxSession.Expand(1440, 'fadf964e9f5bb819f212e5abf5ffb255', false, '35a74b06af8f9ea55ffbda20075b0894');
|
||||||
|
</script>
|
||||||
|
<script>new Image().src='http://www.sgaice.ru/bitrix/spread.php?s=QklUUklYX1NNX0dVRVNUX0lEATY4MTg5NQExNjA5NDQ0NTg5AS8BAQECQklUUklYX1NNX0xBU1RfVklTSVQBMDcuMDEuMjAyMCAwMDo1NjoyOQExNjA5NDQ0NTg5AS8BAQEC&k=71d3b79b44f9716b27b47feab4a206cf';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="/bitrix/cache/js/s1/web20/template_1e341eb2f86845c7519566374f51d35a/template_1e341eb2f86845c7519566374f51d35a_368c1a68876fd1c32b307a10695f3654.js?14010848191120"></script>
|
||||||
|
<script type="text/javascript" src="/bitrix/js/imgzoom/thumb.js"></script>
|
||||||
|
<meta name="google-site-verification" content="gL_64SaiDgQcX5z-pvPZmBJ-exN-wS6KZNoDMcPtYtM" />
|
||||||
|
<title><3E><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ѻ</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="maintop">
|
||||||
|
<table align="left1" width="100%" border="0" cellpadding="0" cellspacing="0">
|
||||||
|
<tr><td valign="top">
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
top.BX.defer(top.rsasec_form_bind)({'formid':'system_auth_form6zOUGO','key':{'M':'HazQxsgvQCIFPf30iHR40R22fp7P9YLPXFhQu6uus68RZxf2IpMo9v0KDpxkgg43WXaZaXrTRvjg1e2126IOo66vH5bphkMP/69MSPlEoaXYzWjTokd+Yzy30WR6HEOyB9tJwADGyjysqoE4+jUfHZQv2JMaVZS0U4SHWOUPwNU=','E':'AQAB','chunk':'128'},'rsa_rand':'5e1390ed8a8e19.17355178','params':['USER_PASSWORD']});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div id="login-form-window">
|
||||||
|
|
||||||
|
<a href="" onclick="return CloseLoginForm()" style="float:right;"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></a>
|
||||||
|
|
||||||
|
<form method="post" target="_top" action="/index.php?login=yes">
|
||||||
|
<input type="hidden" name="backurl" value="/index.php" />
|
||||||
|
<input type="hidden" name="AUTH_FORM" value="Y" />
|
||||||
|
<input type="hidden" name="TYPE" value="AUTH" />
|
||||||
|
|
||||||
|
<table width="95%">
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<09><><EFBFBD><EFBFBD><EFBFBD>:<br />
|
||||||
|
<input type="text" name="USER_LOGIN" maxlength="50" value="
|
||||||
Reference in New Issue
Block a user