Changeset 019ab8e in mod_gnutls
- Timestamp:
- Dec 1, 2019, 1:30:59 PM (3 years ago)
- Branches:
- asyncio, master, proxy-ticket
- Children:
- dec05c4
- Parents:
- 8335f8c
- Location:
- test
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/https-test-client.py
r8335f8c r019ab8e 113 113 114 114 def check_response(self, response, body): 115 if self.expects_conn_reset(): 116 raise TestExpectationFailed( 117 'Got a response, but connection should have failed!') 115 118 if response.status != self.expect['status']: 116 119 raise TestExpectationFailed( … … 119 122 if 'body' in self.expect: 120 123 self._check_body(body) 124 125 def expects_conn_reset(self): 126 if 'reset' in self.expect: 127 return self.expect['reset'] 128 return False 121 129 122 130 @classmethod … … 227 235 for act in test_actions: 228 236 if type(act) is TestRequest: 229 # Add headers={'Host': 'test.host'} to provoke "421 230 # Misdirected 231 conn.request(act.method, act.path, headers=act.headers) 232 resp = conn.getresponse() 237 try: 238 conn.request(act.method, act.path, headers=act.headers) 239 resp = conn.getresponse() 240 except ConnectionResetError as err: 241 if act.expects_conn_reset(): 242 print('connection reset as expected.') 243 break 244 else: 245 raise err 233 246 body = resp.read().decode() 234 247 print(format_response(resp, body))
Note: See TracChangeset
for help on using the changeset viewer.