Skip to content

Commit

Permalink
Option to not verify upstream ssl (#1459)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinavsingh authored Aug 13, 2024
1 parent 0bfd7d7 commit aa596f9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions proxy/http/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ def client(
scheme: bytes = HTTPS_PROTO,
timeout: float = DEFAULT_TIMEOUT,
content_type: bytes = b'application/x-www-form-urlencoded',
verify: bool = True,
) -> Optional[HttpParser]:
"""Makes a request to remote registry endpoint"""
"""HTTP Client"""
request = build_http_request(
method=method,
url=path,
Expand All @@ -53,9 +54,10 @@ def client(
sock: TcpOrTlsSocket = conn
if scheme == HTTPS_PROTO:
try:
ctx = ssl.SSLContext(protocol=(ssl.PROTOCOL_TLS_CLIENT))
ctx = ssl.SSLContext(protocol=ssl.PROTOCOL_TLS_CLIENT)
ctx.options |= DEFAULT_SSL_CONTEXT_OPTIONS
ctx.verify_mode = ssl.CERT_REQUIRED
ctx.check_hostname = verify
ctx.verify_mode = ssl.CERT_NONE if not verify else ssl.CERT_REQUIRED
ctx.load_default_certs()
sock = ctx.wrap_socket(conn, server_hostname=host.decode())
except Exception as exc:
Expand Down

0 comments on commit aa596f9

Please sign in to comment.