mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #27214 from jacksontj/2015.5
Correctly support https, port 443 is not a requirement
This commit is contained in:
commit
560545c4c5
1 changed files with 6 additions and 2 deletions
|
@ -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…
Add table
Reference in a new issue