File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -33,8 +33,9 @@ def client(
33
33
scheme : bytes = HTTPS_PROTO ,
34
34
timeout : float = DEFAULT_TIMEOUT ,
35
35
content_type : bytes = b'application/x-www-form-urlencoded' ,
36
+ verify : bool = True ,
36
37
) -> Optional [HttpParser ]:
37
- """Makes a request to remote registry endpoint """
38
+ """HTTP Client """
38
39
request = build_http_request (
39
40
method = method ,
40
41
url = path ,
@@ -53,9 +54,10 @@ def client(
53
54
sock : TcpOrTlsSocket = conn
54
55
if scheme == HTTPS_PROTO :
55
56
try :
56
- ctx = ssl .SSLContext (protocol = ( ssl .PROTOCOL_TLS_CLIENT ) )
57
+ ctx = ssl .SSLContext (protocol = ssl .PROTOCOL_TLS_CLIENT )
57
58
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
59
61
ctx .load_default_certs ()
60
62
sock = ctx .wrap_socket (conn , server_hostname = host .decode ())
61
63
except Exception as exc :
You can’t perform that action at this time.
0 commit comments