When reading from an SSL socket, attempt to fully fill the caller's buffer
The current SSLClientSocket implementation reads one SSL
record at a time, and immediately returns that to the caller
of Read(). As it is a common performance optimization to set
SSL record sizes to fit within MTU, this leads to suboptimal
performance and causes SSLClientSocket::Read() to not
match the behaviour of TCPClientSocket::Read() (which
attempts to fully fill the caller's buffer).
BUG=166903
Review URL: https://chromiumcodereview.appspot.com/12025040
git-svn-id: http://src.chromium.org/svn/trunk/src/net/tools/testserver@182912 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
diff --git a/testserver.py b/testserver.py
index d442671..0fe9bd7 100755
--- a/testserver.py
+++ b/testserver.py
@@ -265,6 +265,7 @@
self.MultipartHandler,
self.MultipartSlowHandler,
self.GetSSLSessionCacheHandler,
+ self.SSLManySmallRecords,
self.CloseSocketHandler,
self.RangeResetHandler,
self.DefaultResponseHandler]
@@ -1408,6 +1409,24 @@
' this request')
return True
+ def SSLManySmallRecords(self):
+ """Sends a reply consisting of a variety of small writes. These will be
+ translated into a series of small SSL records when used over an HTTPS
+ server."""
+
+ if not self._ShouldHandleRequest('/ssl-many-small-records'):
+ return False
+
+ self.send_response(200)
+ self.send_header('Content-Type', 'text/plain')
+ self.end_headers()
+
+ # Write ~26K of data, in 1350 byte chunks
+ for i in xrange(20):
+ self.wfile.write('*' * 1350)
+ self.wfile.flush()
+ return True
+
def CloseSocketHandler(self):
"""Closes the socket without sending anything."""