Skip to content

Commit

Permalink
simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
URenko committed May 4, 2024
1 parent 91de223 commit 611ac9b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions accesser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,9 @@ async def handle(reader, writer):
else:
cert_verify_list = [host]
cert_policy = setting.config['check_hostname']
if not cert_policy is False:
try:
next(filter(lambda h:match_hostname(cert, h, cert_policy), cert_verify_list))
except StopIteration:
logger.warning(f"[{i_port:5}] {cert_verify_list} don't march either of {cert_message}.")
return
if cert_policy is not False and not any(match_hostname(cert, h, cert_policy) for h in cert_verify_list):
logger.warning(f"[{i_port:5}] {cert_verify_list} don't march either of {cert_message}.")
return
await asyncio.gather(
forward_stream(reader, remote_writer),
forward_stream(remote_reader, writer)
Expand Down

0 comments on commit 611ac9b

Please sign in to comment.