Merge "Support testing nova-novncproxy on SSL"

This commit is contained in:
Jenkins 2017-04-27 18:58:25 +00:00 committed by Gerrit Code Review
commit 192e64e66b
1 changed files with 6 additions and 1 deletions

View File

@ -15,6 +15,7 @@
import base64
import socket
import ssl
import struct
import textwrap
@ -236,7 +237,11 @@ def shelve_server(servers_client, server_id, force_shelve_offload=False):
def create_websocket(url):
url = urlparse.urlparse(url)
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if url.scheme == 'https':
client_socket = ssl.wrap_socket(socket.socket(socket.AF_INET,
socket.SOCK_STREAM))
else:
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
client_socket.connect((url.hostname, url.port))
# Turn the Socket into a WebSocket to do the communication