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

Unified Diff: net/tools/testserver/testserver.py

Issue 994373004: Properly handle alerts from the peer in SSL_read. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: net/tools/testserver/testserver.py
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py
index 9e8b0bb3916c5fd666859ed558c3f3d7017b3765..56c03a4b08e72747c2978768f2274e7c78bf9e59 100755
--- a/net/tools/testserver/testserver.py
+++ b/net/tools/testserver/testserver.py
@@ -157,7 +157,8 @@ class HTTPSServer(tlslite.api.TLSSocketServerMixIn,
ssl_bulk_ciphers, ssl_key_exchanges, enable_npn,
record_resume_info, tls_intolerant,
tls_intolerance_type, signed_cert_timestamps,
- fallback_scsv_enabled, ocsp_response, disable_session_cache):
+ fallback_scsv_enabled, ocsp_response, disable_session_cache,
+ alert_after_handshake):
self.cert_chain = tlslite.api.X509CertChain()
self.cert_chain.parsePemList(pem_cert_and_key)
# Force using only python implementation - otherwise behavior is different
@@ -202,6 +203,8 @@ class HTTPSServer(tlslite.api.TLSSocketServerMixIn,
if tls_intolerant != 0:
self.ssl_handshake_settings.tlsIntolerant = (3, tls_intolerant)
self.ssl_handshake_settings.tlsIntoleranceType = tls_intolerance_type
+ if alert_after_handshake:
+ self.ssl_handshake_settings.alertAfterHandshake = True
if disable_session_cache:
@@ -2049,7 +2052,8 @@ class ServerRunner(testserver_base.TestServerRunner):
"base64"),
self.options.fallback_scsv,
stapled_ocsp_response,
- self.options.disable_session_cache)
+ self.options.disable_session_cache,
+ self.options.alert_after_handshake)
print 'HTTPS server started on https://%s:%d...' % \
(host, server.server_port)
else:
@@ -2287,6 +2291,11 @@ class ServerRunner(testserver_base.TestServerRunner):
help='If set, the OCSP server will return '
'a tryLater status rather than the actual '
'OCSP response.')
+ self.option_parser.add_option('--alert-after-handshake',
+ dest='alert_after_handshake',
+ default=False, action='store_true',
+ help='If set, the server will send a fatal '
+ 'alert immediately after the handshake.')
if __name__ == '__main__':

Powered by Google App Engine
This is Rietveld 408576698