Chromium Code Reviews| Index: net/tools/testserver/testserver.py |
| diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py |
| index 4870408f7ebf8965273fabb0dca85b497e436e14..c21153c6aec6ba2fe6016f8a7019c7cc77dbe96b 100755 |
| --- a/net/tools/testserver/testserver.py |
| +++ b/net/tools/testserver/testserver.py |
| @@ -84,10 +84,10 @@ class WebSocketOptions: |
| self.allow_draft75 = False |
| self.strict = True |
| - # TODO(toyoshim): Support SSL and authenticates (http://crbug.com/137639) |
| self.use_tls = False |
| self.private_key = None |
| self.certificate = None |
| + self.tls_client_auth = False |
| self.tls_client_ca = None |
| self.use_basic_auth = False |
| @@ -2252,7 +2252,22 @@ def main(options, args): |
| # TODO(toyoshim): Remove following os.chdir. Currently this operation |
| # is required to work correctly. It should be fixed from pywebsocket side. |
| os.chdir(MakeDataDir()) |
| - server = WebSocketServer(WebSocketOptions(host, port, '.')) |
| + websocket_options = WebSocketOptions(host, port, '.') |
| + if options.cert_and_key_file: |
| + websocket_options.use_tls = True |
| + websocket_options.private_key = options.cert_and_key_file |
| + websocket_options.certificate = options.cert_and_key_file |
| + if options.ssl_client_auth: |
| + websocket_options.tls_client_auth = True |
| + if len(options.ssl_client_ca) != 1: |
| + print 'one trusted client CA file should be specified' |
| + return |
|
Paweł Hajdan Jr.
2012/10/16 17:07:24
Those failure cases should make the server exit wi
Takashi Toyoshima
2012/10/17 01:18:42
Other paths need similar fix.
So, just leave TODO
|
| + if not os.path.isfile(options.ssl_client_ca[0]): |
| + print 'specified trusted client CA file not found: ' + \ |
|
Paweł Hajdan Jr.
2012/10/16 17:07:24
nit: Use parentheses ('...' +
Takashi Toyoshima
2012/10/17 01:18:42
Done.
|
| + options.ssl_client_ca[0] + ' exiting...' |
| + return |
| + websocket_options.tls_client_ca = options.ssl_client_ca[0] |
| + server = WebSocketServer(websocket_options) |
| print 'WebSocket server started on %s:%d...' % (host, server.server_port) |
| server_data['port'] = server.server_port |
| elif options.server_type == SERVER_SYNC: |