bugfix:TSG-8020:修复因firewall实现block方式变为先发fin再发送rst包导致自检失败问题

This commit is contained in:
fumingwei
2021-10-15 14:42:25 +08:00
parent 33f5659cbd
commit c848872061

View File

@@ -858,32 +858,22 @@ class HttpFirewallActionBuild:
raise Exception(http_firewall_deny_rst_re)
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
bodyBuf = BytesIO()
self._set_conn_opt(test_suite_name,URLHttpFirewallDenyBlock)
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\'")
self.conn.setopt(self.conn.WRITEDATA, bodyBuf)
self.conn.perform()
rescode = self.conn.getinfo(self.conn.RESPONSE_CODE)
self.conn.close()
if rescode == 403:
if re.search(r'dign-testing-deny-block', bodyBuf.getvalue().decode('utf-8'), 0):
raise Exception(http_firewall_deny_block_re)
else:
raise Exception("Error:The connection is not close by send rst,error info : %s" % errorinfo)
raise Exception("Error: response content is not required, required \'dign-testing-deny-block\'")
else:
raise Exception("Error: The stream may be not block, http code %s " % rescode)
class SslFirewallActionBuild:
def __init__(self):