diff options
| author | fumingwei <[email protected]> | 2021-10-14 10:15:15 +0800 |
|---|---|---|
| committer | fumingwei <[email protected]> | 2021-10-14 10:15:15 +0800 |
| commit | 5ed6a5b1ebcc2148047dc2ae42465366d047ee4c (patch) | |
| tree | 87eb245df926faef9520a674cfe02a9a8a26d1c7 | |
| parent | 44309fb2631dc3f30e7c84e425fd852234a34ffa (diff) | |
bugfix:TSG-8020:修改firewallblock动作时由发送FIN结束连接变为发送RST结束连接导致自检失败bug
| -rw-r--r-- | images_build/client/dign_client/bin/client.py | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/images_build/client/dign_client/bin/client.py b/images_build/client/dign_client/bin/client.py index f2c9373..6b8b444 100644 --- a/images_build/client/dign_client/bin/client.py +++ b/images_build/client/dign_client/bin/client.py @@ -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): |
