File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -33,8 +33,9 @@ def client(
3333 scheme : bytes = HTTPS_PROTO ,
3434 timeout : float = DEFAULT_TIMEOUT ,
3535 content_type : bytes = b'application/x-www-form-urlencoded' ,
36+ verify : bool = True ,
3637) -> Optional [HttpParser ]:
37- """Makes a request to remote registry endpoint """
38+ """HTTP Client """
3839 request = build_http_request (
3940 method = method ,
4041 url = path ,
@@ -53,9 +54,10 @@ def client(
5354 sock : TcpOrTlsSocket = conn
5455 if scheme == HTTPS_PROTO :
5556 try :
56- ctx = ssl .SSLContext (protocol = ( ssl .PROTOCOL_TLS_CLIENT ) )
57+ ctx = ssl .SSLContext (protocol = ssl .PROTOCOL_TLS_CLIENT )
5758 ctx .options |= DEFAULT_SSL_CONTEXT_OPTIONS
58- ctx .verify_mode = ssl .CERT_REQUIRED
59+ ctx .check_hostname = verify
60+ ctx .verify_mode = ssl .CERT_NONE if not verify else ssl .CERT_REQUIRED
5961 ctx .load_default_certs ()
6062 sock = ctx .wrap_socket (conn , server_hostname = host .decode ())
6163 except Exception as exc :
You can’t perform that action at this time.
0 commit comments