bugfix:TSG-8020:修改firewallblock动作时由发送FIN结束连接变为发送RST结束连接导致自检失败bug

This commit is contained in:
fumingwei
2021-10-14 10:15:15 +08:00
parent 44309fb263
commit 5ed6a5b1eb

View File

@@ -859,16 +859,31 @@ class HttpFirewallActionBuild:
else:
raise Exception("Error: The stream may be not rst %s" % errorinfo)
def verify_debug_msg(self,debug_type,debug_msg):
if re.search(r'403 Forbidden', debug_msg.decode('utf8'), 0):
self.blockinfo_rsp_code_verify_ok=True
if re.search(r'dign-testing-deny-block', debug_msg.decode('utf8'), 0):
self.blockinfo_rsp_content_verify_ok=True
def action_deny_subaction_block(self,test_suite_name):
self.blockinfo_rsp_code_verify_ok=False
self.blockinfo_rsp_content_verify_ok=False
self._set_conn_opt(test_suite_name,URLHttpFirewallDenyBlock)
self.conn.perform()
rescode = self.conn.getinfo(self.conn.RESPONSE_CODE)
self.conn.close()
if rescode == 403:
raise Exception(http_firewall_deny_block_re)
else:
raise Exception("Error: The stream may be not block, http code %s " % rescode)
self.conn.setopt(self.conn.VERBOSE,1)
self.conn.setopt(self.conn.DEBUGFUNCTION, self.verify_debug_msg)
try:
self.conn.perform()
self.conn.close()
except pycurl.error as errorinfo:
errcode = errorinfo.args[0]
if(errcode == 56):
if self.blockinfo_rsp_code_verify_ok == False:
raise Exception("Error:response code is not reqiured,reqiured 403")
if self.blockinfo_rsp_content_verify_ok == False:
raise Exception("Error: response content is not required, required \'dign-testing-deny-block\'")
raise Exception(http_firewall_deny_block_re)
else:
raise Exception("Error:The connection is not close by send rst,error info : %s" % errorinfo)
class SslFirewallActionBuild:
def __init__(self):