mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Correctly support https, port 443 is not a requirement
This commit is contained in:
parent
7a34c7742d
commit
e7526bdb44
@ -287,7 +287,7 @@ def query(url,
|
||||
if password_mgr:
|
||||
handlers.append(urllib_request.HTTPBasicAuthHandler(password_mgr))
|
||||
|
||||
if url.startswith('https') or port == 443:
|
||||
if url.startswith('https'):
|
||||
if not HAS_MATCHHOSTNAME:
|
||||
log.warn(('match_hostname() not available, SSL hostname checking '
|
||||
'not available. THIS CONNECTION MAY NOT BE SECURE!'))
|
||||
@ -296,8 +296,12 @@ def query(url,
|
||||
'disabled. THIS CONNECTION MAY NOT BE SECURE!'))
|
||||
else:
|
||||
hostname = request.get_host()
|
||||
if ':' in hostname:
|
||||
hostname, port = hostname.split(':')
|
||||
else:
|
||||
port = 443
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.connect((hostname, 443))
|
||||
sock.connect((hostname, int(port)))
|
||||
sockwrap = ssl.wrap_socket(
|
||||
sock,
|
||||
ca_certs=ca_bundle,
|
||||
|
Loading…
Reference in New Issue
Block a user