Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: net/tools/testserver/testserver.py

Issue 1351133002: Revert of Add flags to python test server for channel id, extended master secret, and token binding (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/test/spawned_test_server/base_test_server.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 testserver_base.StoppableHTTPServer): 151 testserver_base.StoppableHTTPServer):
152 """This is a specialization of StoppableHTTPServer that add https support and 152 """This is a specialization of StoppableHTTPServer that add https support and
153 client verification.""" 153 client verification."""
154 154
155 def __init__(self, server_address, request_hander_class, pem_cert_and_key, 155 def __init__(self, server_address, request_hander_class, pem_cert_and_key,
156 ssl_client_auth, ssl_client_cas, ssl_client_cert_types, 156 ssl_client_auth, ssl_client_cas, ssl_client_cert_types,
157 ssl_bulk_ciphers, ssl_key_exchanges, enable_npn, 157 ssl_bulk_ciphers, ssl_key_exchanges, enable_npn,
158 record_resume_info, tls_intolerant, 158 record_resume_info, tls_intolerant,
159 tls_intolerance_type, signed_cert_timestamps, 159 tls_intolerance_type, signed_cert_timestamps,
160 fallback_scsv_enabled, ocsp_response, 160 fallback_scsv_enabled, ocsp_response,
161 alert_after_handshake, disable_channel_id, disable_ems, 161 alert_after_handshake):
162 token_binding_params):
163 self.cert_chain = tlslite.api.X509CertChain() 162 self.cert_chain = tlslite.api.X509CertChain()
164 self.cert_chain.parsePemList(pem_cert_and_key) 163 self.cert_chain.parsePemList(pem_cert_and_key)
165 # Force using only python implementation - otherwise behavior is different 164 # Force using only python implementation - otherwise behavior is different
166 # depending on whether m2crypto Python module is present (error is thrown 165 # depending on whether m2crypto Python module is present (error is thrown
167 # when it is). m2crypto uses a C (based on OpenSSL) implementation under 166 # when it is). m2crypto uses a C (based on OpenSSL) implementation under
168 # the hood. 167 # the hood.
169 self.private_key = tlslite.api.parsePEMKey(pem_cert_and_key, 168 self.private_key = tlslite.api.parsePEMKey(pem_cert_and_key,
170 private=True, 169 private=True,
171 implementations=['python']) 170 implementations=['python'])
172 self.ssl_client_auth = ssl_client_auth 171 self.ssl_client_auth = ssl_client_auth
(...skipping 25 matching lines...) Expand all
198 self.ssl_handshake_settings.minVersion = (3, 0) 197 self.ssl_handshake_settings.minVersion = (3, 0)
199 if ssl_bulk_ciphers is not None: 198 if ssl_bulk_ciphers is not None:
200 self.ssl_handshake_settings.cipherNames = ssl_bulk_ciphers 199 self.ssl_handshake_settings.cipherNames = ssl_bulk_ciphers
201 if ssl_key_exchanges is not None: 200 if ssl_key_exchanges is not None:
202 self.ssl_handshake_settings.keyExchangeNames = ssl_key_exchanges 201 self.ssl_handshake_settings.keyExchangeNames = ssl_key_exchanges
203 if tls_intolerant != 0: 202 if tls_intolerant != 0:
204 self.ssl_handshake_settings.tlsIntolerant = (3, tls_intolerant) 203 self.ssl_handshake_settings.tlsIntolerant = (3, tls_intolerant)
205 self.ssl_handshake_settings.tlsIntoleranceType = tls_intolerance_type 204 self.ssl_handshake_settings.tlsIntoleranceType = tls_intolerance_type
206 if alert_after_handshake: 205 if alert_after_handshake:
207 self.ssl_handshake_settings.alertAfterHandshake = True 206 self.ssl_handshake_settings.alertAfterHandshake = True
208 if disable_channel_id:
209 self.ssl_handshake_settings.enableChannelID = False
210 if disable_ems:
211 self.ssl_handshake_settings.enableExtendedMasterSecret = False
212 self.ssl_handshake_settings.supportedTokenBindingParams = \
213 token_binding_params
214 207
215 if record_resume_info: 208 if record_resume_info:
216 # If record_resume_info is true then we'll replace the session cache with 209 # If record_resume_info is true then we'll replace the session cache with
217 # an object that records the lookups and inserts that it sees. 210 # an object that records the lookups and inserts that it sees.
218 self.session_cache = RecordingSSLSessionCache() 211 self.session_cache = RecordingSSLSessionCache()
219 else: 212 else:
220 self.session_cache = tlslite.api.SessionCache() 213 self.session_cache = tlslite.api.SessionCache()
221 testserver_base.StoppableHTTPServer.__init__(self, 214 testserver_base.StoppableHTTPServer.__init__(self,
222 server_address, 215 server_address,
223 request_hander_class) 216 request_hander_class)
(...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after
2057 self.options.ssl_bulk_cipher, 2050 self.options.ssl_bulk_cipher,
2058 self.options.ssl_key_exchange, 2051 self.options.ssl_key_exchange,
2059 self.options.enable_npn, 2052 self.options.enable_npn,
2060 self.options.record_resume, 2053 self.options.record_resume,
2061 self.options.tls_intolerant, 2054 self.options.tls_intolerant,
2062 self.options.tls_intolerance_type, 2055 self.options.tls_intolerance_type,
2063 self.options.signed_cert_timestamps_tls_ext.decode( 2056 self.options.signed_cert_timestamps_tls_ext.decode(
2064 "base64"), 2057 "base64"),
2065 self.options.fallback_scsv, 2058 self.options.fallback_scsv,
2066 stapled_ocsp_response, 2059 stapled_ocsp_response,
2067 self.options.alert_after_handshake, 2060 self.options.alert_after_handshake)
2068 self.options.disable_channel_id,
2069 self.options.disable_extended_master_secret,
2070 self.options.token_binding_params)
2071 print 'HTTPS server started on https://%s:%d...' % \ 2061 print 'HTTPS server started on https://%s:%d...' % \
2072 (host, server.server_port) 2062 (host, server.server_port)
2073 else: 2063 else:
2074 server = HTTPServer((host, port), TestPageHandler) 2064 server = HTTPServer((host, port), TestPageHandler)
2075 print 'HTTP server started on http://%s:%d...' % \ 2065 print 'HTTP server started on http://%s:%d...' % \
2076 (host, server.server_port) 2066 (host, server.server_port)
2077 2067
2078 server.data_dir = self.__make_data_dir() 2068 server.data_dir = self.__make_data_dir()
2079 server.file_root_url = self.options.file_root_url 2069 server.file_root_url = self.options.file_root_url
2080 server_data['port'] = server.server_port 2070 server_data['port'] = server.server_port
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2306 self.option_parser.add_option('--alert-after-handshake', 2296 self.option_parser.add_option('--alert-after-handshake',
2307 dest='alert_after_handshake', 2297 dest='alert_after_handshake',
2308 default=False, action='store_true', 2298 default=False, action='store_true',
2309 help='If set, the server will send a fatal ' 2299 help='If set, the server will send a fatal '
2310 'alert immediately after the handshake.') 2300 'alert immediately after the handshake.')
2311 self.option_parser.add_option('--no-anonymous-ftp-user', 2301 self.option_parser.add_option('--no-anonymous-ftp-user',
2312 dest='no_anonymous_ftp_user', 2302 dest='no_anonymous_ftp_user',
2313 default=False, action='store_true', 2303 default=False, action='store_true',
2314 help='If set, the FTP server will not create ' 2304 help='If set, the FTP server will not create '
2315 'an anonymous user.') 2305 'an anonymous user.')
2316 self.option_parser.add_option('--disable-channel-id', action='store_true')
2317 self.option_parser.add_option('--disable-extended-master-secret',
2318 action='store_true')
2319 self.option_parser.add_option('--token-binding-params', action='append',
2320 default=[], type='int')
2321 2306
2322 2307
2323 if __name__ == '__main__': 2308 if __name__ == '__main__':
2324 sys.exit(ServerRunner().main()) 2309 sys.exit(ServerRunner().main())
OLDNEW
« no previous file with comments | « net/test/spawned_test_server/base_test_server.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698