| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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/SYNC/TCP/UDP/ server used for testing Chrome. | 6 """This is a simple HTTP/FTP/SYNC/TCP/UDP/ server used for testing Chrome. |
| 7 | 7 |
| 8 It supports several test URLs, as specified by the handlers in TestPageHandler. | 8 It supports several test URLs, as specified by the handlers in TestPageHandler. |
| 9 By default, it listens on an ephemeral port and sends the port number back to | 9 By default, it listens on an ephemeral port and sends the port number back to |
| 10 the originating process over a pipe. The originating process can specify an | 10 the originating process over a pipe. The originating process can specify an |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 class HTTPSServer(tlslite.api.TLSSocketServerMixIn, | 113 class HTTPSServer(tlslite.api.TLSSocketServerMixIn, |
| 114 ClientRestrictingServerMixIn, | 114 ClientRestrictingServerMixIn, |
| 115 StoppableHTTPServer): | 115 StoppableHTTPServer): |
| 116 """This is a specialization of StoppableHTTPerver that add https support and | 116 """This is a specialization of StoppableHTTPerver that add https support and |
| 117 client verification.""" | 117 client verification.""" |
| 118 | 118 |
| 119 def __init__(self, server_address, request_hander_class, cert_path, | 119 def __init__(self, server_address, request_hander_class, cert_path, |
| 120 ssl_client_auth, ssl_client_cas, ssl_bulk_ciphers, | 120 ssl_client_auth, ssl_client_cas, ssl_bulk_ciphers, |
| 121 record_resume_info): | 121 record_resume_info): |
| 122 s = open(cert_path).read() | 122 s = open(cert_path).read() |
| 123 x509 = tlslite.api.X509() | 123 self.cert_chain = tlslite.api.X509CertChain().parseChain(s) |
| 124 x509.parse(s) | |
| 125 self.cert_chain = tlslite.api.X509CertChain([x509]) | |
| 126 s = open(cert_path).read() | 124 s = open(cert_path).read() |
| 127 self.private_key = tlslite.api.parsePEMKey(s, private=True) | 125 self.private_key = tlslite.api.parsePEMKey(s, private=True) |
| 128 self.ssl_client_auth = ssl_client_auth | 126 self.ssl_client_auth = ssl_client_auth |
| 129 self.ssl_client_cas = [] | 127 self.ssl_client_cas = [] |
| 130 for ca_file in ssl_client_cas: | 128 for ca_file in ssl_client_cas: |
| 131 s = open(ca_file).read() | 129 s = open(ca_file).read() |
| 132 x509 = tlslite.api.X509() | 130 x509 = tlslite.api.X509() |
| 133 x509.parse(s) | 131 x509.parse(s) |
| 134 self.ssl_client_cas.append(x509.subject) | 132 self.ssl_client_cas.append(x509.subject) |
| 135 self.ssl_handshake_settings = tlslite.api.HandshakeSettings() | 133 self.ssl_handshake_settings = tlslite.api.HandshakeSettings() |
| (...skipping 1936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2072 'report back to the client as the user owning the ' | 2070 'report back to the client as the user owning the ' |
| 2073 'token used for making the policy request.') | 2071 'token used for making the policy request.') |
| 2074 option_parser.add_option('', '--host', default='127.0.0.1', | 2072 option_parser.add_option('', '--host', default='127.0.0.1', |
| 2075 dest='host', | 2073 dest='host', |
| 2076 help='Hostname or IP upon which the server will ' | 2074 help='Hostname or IP upon which the server will ' |
| 2077 'listen. Client connections will also only be ' | 2075 'listen. Client connections will also only be ' |
| 2078 'allowed from this address.') | 2076 'allowed from this address.') |
| 2079 options, args = option_parser.parse_args() | 2077 options, args = option_parser.parse_args() |
| 2080 | 2078 |
| 2081 sys.exit(main(options, args)) | 2079 sys.exit(main(options, args)) |
| OLD | NEW |