控制策略配置导入增加限制.
This commit is contained in:
@@ -111,7 +111,11 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
}
|
||||
// 代理HTTP(s)阻断
|
||||
if (regionDict.getFunctionId().equals(207)) {
|
||||
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
|
||||
baseStringCfg.setUserRegion1("404");
|
||||
}
|
||||
String userRegion1 = baseStringCfg.getUserRegion1();// 应答码
|
||||
String userRegion2 = baseStringCfg.getUserRegion2();// 响应内容
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("RESPONSE_CODE");
|
||||
boolean has = false;
|
||||
@@ -126,6 +130,9 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
prop.getProperty("response_code") + " ") + ";");
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(userRegion2) && userRegion2.length() > 1024) {
|
||||
errInfo.append(prop.getProperty("response_content")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":1024") + ";");
|
||||
}
|
||||
|
||||
}
|
||||
// 代理 HTTP(s)重定向
|
||||
@@ -165,7 +172,13 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
}
|
||||
// 代理HTTP(s)替换
|
||||
if (regionDict.getFunctionId().equals(209)) {
|
||||
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
|
||||
baseStringCfg.setUserRegion1("http_resp_body");
|
||||
}
|
||||
String userRegion1 = baseStringCfg.getUserRegion1();// 搜索区域
|
||||
String userRegion2 = baseStringCfg.getUserRegion2();// 发现内容
|
||||
String userRegion3 = baseStringCfg.getUserRegion3();// 替换内容
|
||||
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("CONTROL_REPLACE_ZONE");
|
||||
boolean has = false;
|
||||
@@ -180,6 +193,19 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
prop.getProperty("replace_zone") + " ") + ";");
|
||||
}
|
||||
}
|
||||
if (StringUtils.isBlank(userRegion2)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("replaced_content") + " ") + ";");
|
||||
}else if(userRegion2.length() > 1024) {
|
||||
errInfo.append(prop.getProperty("replaced_content")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":1024") + ";");
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(userRegion3)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("replace_content") + " ") + ";");
|
||||
}else if(userRegion3.length() > 1024) {
|
||||
errInfo.append(prop.getProperty("replace_content")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":1024") + ";");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -385,7 +385,11 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
}
|
||||
// 代理HTTP(s)阻断
|
||||
if (regionDict.getFunctionId().equals(207)) {
|
||||
if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) {
|
||||
baseIpCfg.setUserRegion1("404");
|
||||
}
|
||||
String userRegion1 = baseIpCfg.getUserRegion1();// 应答码
|
||||
String userRegion2 = baseIpCfg.getUserRegion2();// 响应内容
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("RESPONSE_CODE");
|
||||
boolean has = false;
|
||||
@@ -400,6 +404,9 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
prop.getProperty("response_code") + " ") + ";");
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(userRegion2) && userRegion2.length() > 1024) {
|
||||
errInfo.append(prop.getProperty("response_content")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":1024") + ";");
|
||||
}
|
||||
|
||||
}
|
||||
// 代理 HTTP(s)重定向
|
||||
@@ -439,8 +446,14 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
}
|
||||
// 代理HTTP(s)替换
|
||||
if (regionDict.getFunctionId().equals(209)) {
|
||||
if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) {
|
||||
baseIpCfg.setUserRegion1("http_resp_body");
|
||||
}
|
||||
String userRegion1 = baseIpCfg.getUserRegion1();// 搜索区域
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
String userRegion2 = baseIpCfg.getUserRegion2();// 发现内容
|
||||
String userRegion3 = baseIpCfg.getUserRegion3();// 替换内容
|
||||
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("CONTROL_REPLACE_ZONE");
|
||||
boolean has = false;
|
||||
for (SysDataDictionaryItem dict : dicts) {
|
||||
@@ -454,7 +467,19 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
prop.getProperty("replace_zone") + " ") + ";");
|
||||
}
|
||||
}
|
||||
if (StringUtils.isBlank(userRegion2)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("replaced_content") + " ") + ";");
|
||||
}else if(userRegion2.length() > 1024) {
|
||||
errInfo.append(prop.getProperty("replaced_content")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":1024") + ";");
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(userRegion3)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("replace_content") + " ") + ";");
|
||||
}else if(userRegion3.length() > 1024) {
|
||||
errInfo.append(prop.getProperty("replace_content")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":1024") + ";");
|
||||
}
|
||||
}
|
||||
|
||||
// 拦截策略(限速)
|
||||
|
||||
@@ -159,7 +159,11 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
}
|
||||
// 代理HTTP(s)阻断
|
||||
if (regionDict.getFunctionId().equals(207)) {
|
||||
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
|
||||
baseStringCfg.setUserRegion1("404");
|
||||
}
|
||||
String userRegion1 = baseStringCfg.getUserRegion1();// 应答码
|
||||
String userRegion2 = baseStringCfg.getUserRegion2();// 响应内容
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("RESPONSE_CODE");
|
||||
boolean has = false;
|
||||
@@ -174,6 +178,9 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
prop.getProperty("response_code") + " ") + ";");
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(userRegion2) && userRegion2.length() > 1024) {
|
||||
errInfo.append(prop.getProperty("response_content")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":1024") + ";");
|
||||
}
|
||||
|
||||
}
|
||||
// 代理 HTTP(s)重定向
|
||||
@@ -213,7 +220,13 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
}
|
||||
// 代理HTTP(s)替换
|
||||
if (regionDict.getFunctionId().equals(209)) {
|
||||
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
|
||||
baseStringCfg.setUserRegion1("http_resp_body");
|
||||
}
|
||||
String userRegion1 = baseStringCfg.getUserRegion1();// 搜索区域
|
||||
String userRegion2 = baseStringCfg.getUserRegion2();// 发现内容
|
||||
String userRegion3 = baseStringCfg.getUserRegion3();// 替换内容
|
||||
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("CONTROL_REPLACE_ZONE");
|
||||
boolean has = false;
|
||||
@@ -228,6 +241,19 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
prop.getProperty("replace_zone") + " ") + ";");
|
||||
}
|
||||
}
|
||||
if (StringUtils.isBlank(userRegion2)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("replaced_content") + " ") + ";");
|
||||
}else if(userRegion2.length() > 1024) {
|
||||
errInfo.append(prop.getProperty("replaced_content")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":1024") + ";");
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(userRegion3)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("replace_content") + " ") + ";");
|
||||
}else if(userRegion3.length() > 1024) {
|
||||
errInfo.append(prop.getProperty("replace_content")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":1024") + ";");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user