OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """This is a simple HTTP/FTP/TCP/UDP/BASIC_AUTH_PROXY/WEBSOCKET server used for | 6 """This is a simple HTTP/FTP/TCP/UDP/BASIC_AUTH_PROXY/WEBSOCKET server used for |
7 testing Chrome. | 7 testing Chrome. |
8 | 8 |
9 It supports several test URLs, as specified by the handlers in TestPageHandler. | 9 It supports several test URLs, as specified by the handlers in TestPageHandler. |
10 By default, it listens on an ephemeral port and sends the port number back to | 10 By default, it listens on an ephemeral port and sends the port number back to |
(...skipping 1993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2004 # is required to work correctly. It should be fixed from pywebsocket side. | 2004 # is required to work correctly. It should be fixed from pywebsocket side. |
2005 os.chdir(self.__make_data_dir()) | 2005 os.chdir(self.__make_data_dir()) |
2006 websocket_options = WebSocketOptions(host, port, '.') | 2006 websocket_options = WebSocketOptions(host, port, '.') |
2007 scheme = "ws" | 2007 scheme = "ws" |
2008 if self.options.cert_and_key_file: | 2008 if self.options.cert_and_key_file: |
2009 scheme = "wss" | 2009 scheme = "wss" |
2010 websocket_options.use_tls = True | 2010 websocket_options.use_tls = True |
2011 websocket_options.private_key = self.options.cert_and_key_file | 2011 websocket_options.private_key = self.options.cert_and_key_file |
2012 websocket_options.certificate = self.options.cert_and_key_file | 2012 websocket_options.certificate = self.options.cert_and_key_file |
2013 if self.options.ssl_client_auth: | 2013 if self.options.ssl_client_auth: |
| 2014 websocket_options.tls_client_cert_optional = False |
2014 websocket_options.tls_client_auth = True | 2015 websocket_options.tls_client_auth = True |
2015 if len(self.options.ssl_client_ca) != 1: | 2016 if len(self.options.ssl_client_ca) != 1: |
2016 raise testserver_base.OptionError( | 2017 raise testserver_base.OptionError( |
2017 'one trusted client CA file should be specified') | 2018 'one trusted client CA file should be specified') |
2018 if not os.path.isfile(self.options.ssl_client_ca[0]): | 2019 if not os.path.isfile(self.options.ssl_client_ca[0]): |
2019 raise testserver_base.OptionError( | 2020 raise testserver_base.OptionError( |
2020 'specified trusted client CA file not found: ' + | 2021 'specified trusted client CA file not found: ' + |
2021 self.options.ssl_client_ca[0] + ' exiting...') | 2022 self.options.ssl_client_ca[0] + ' exiting...') |
2022 websocket_options.tls_client_ca = self.options.ssl_client_ca[0] | 2023 websocket_options.tls_client_ca = self.options.ssl_client_ca[0] |
2023 server = WebSocketServer(websocket_options) | 2024 server = WebSocketServer(websocket_options) |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2202 action='store_const', | 2203 action='store_const', |
2203 help='Enable server support for the NPN ' | 2204 help='Enable server support for the NPN ' |
2204 'extension. The server will advertise ' | 2205 'extension. The server will advertise ' |
2205 'support for exactly one protocol, http/1.1') | 2206 'support for exactly one protocol, http/1.1') |
2206 self.option_parser.add_option('--file-root-url', default='/files/', | 2207 self.option_parser.add_option('--file-root-url', default='/files/', |
2207 help='Specify a root URL for files served.') | 2208 help='Specify a root URL for files served.') |
2208 | 2209 |
2209 | 2210 |
2210 if __name__ == '__main__': | 2211 if __name__ == '__main__': |
2211 sys.exit(ServerRunner().main()) | 2212 sys.exit(ServerRunner().main()) |
OLD | NEW |