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

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

Issue 12025040: When reading from an SSL socket, attempt to fully fill the caller's buffer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Last minute compile fixes Created 7 years, 10 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 | Annotate | Revision Log
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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 self.AuthDigestHandler, 258 self.AuthDigestHandler,
259 self.SlowServerHandler, 259 self.SlowServerHandler,
260 self.ChunkedServerHandler, 260 self.ChunkedServerHandler,
261 self.ContentTypeHandler, 261 self.ContentTypeHandler,
262 self.NoContentHandler, 262 self.NoContentHandler,
263 self.ServerRedirectHandler, 263 self.ServerRedirectHandler,
264 self.ClientRedirectHandler, 264 self.ClientRedirectHandler,
265 self.MultipartHandler, 265 self.MultipartHandler,
266 self.MultipartSlowHandler, 266 self.MultipartSlowHandler,
267 self.GetSSLSessionCacheHandler, 267 self.GetSSLSessionCacheHandler,
268 self.SSLManySmallRecords,
268 self.CloseSocketHandler, 269 self.CloseSocketHandler,
269 self.RangeResetHandler, 270 self.RangeResetHandler,
270 self.DefaultResponseHandler] 271 self.DefaultResponseHandler]
271 post_handlers = [ 272 post_handlers = [
272 self.EchoTitleHandler, 273 self.EchoTitleHandler,
273 self.EchoHandler, 274 self.EchoHandler,
274 self.DeviceManagementHandler, 275 self.DeviceManagementHandler,
275 self.PostOnlyFileHandler] + get_handlers 276 self.PostOnlyFileHandler] + get_handlers
276 put_handlers = [ 277 put_handlers = [
277 self.EchoTitleHandler, 278 self.EchoTitleHandler,
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 self.send_header('Content-Type', 'text/plain') 1402 self.send_header('Content-Type', 'text/plain')
1402 self.end_headers() 1403 self.end_headers()
1403 try: 1404 try:
1404 for (action, sessionID) in self.server.session_cache.log: 1405 for (action, sessionID) in self.server.session_cache.log:
1405 self.wfile.write('%s\t%s\n' % (action, sessionID.encode('hex'))) 1406 self.wfile.write('%s\t%s\n' % (action, sessionID.encode('hex')))
1406 except AttributeError: 1407 except AttributeError:
1407 self.wfile.write('Pass --https-record-resume in order to use' + 1408 self.wfile.write('Pass --https-record-resume in order to use' +
1408 ' this request') 1409 ' this request')
1409 return True 1410 return True
1410 1411
1412 def SSLManySmallRecords(self):
1413 """Sends a reply consisting of a variety of small writes. These will be
1414 translated into a series of small SSL records when used over an HTTPS
1415 server."""
1416
1417 if not self._ShouldHandleRequest('/ssl-many-small-records'):
1418 return False
1419
1420 self.send_response(200)
1421 self.send_header('Content-Type', 'text/plain')
1422 self.end_headers()
1423
1424 # Write ~26K of data, in 1350 byte chunks
1425 for i in xrange(20):
1426 self.wfile.write('*' * 1350)
1427 self.wfile.flush()
1428 return True
1429
1411 def CloseSocketHandler(self): 1430 def CloseSocketHandler(self):
1412 """Closes the socket without sending anything.""" 1431 """Closes the socket without sending anything."""
1413 1432
1414 if not self._ShouldHandleRequest('/close-socket'): 1433 if not self._ShouldHandleRequest('/close-socket'):
1415 return False 1434 return False
1416 1435
1417 self.wfile.close() 1436 self.wfile.close()
1418 return True 1437 return True
1419 1438
1420 def RangeResetHandler(self): 1439 def RangeResetHandler(self):
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
2044 'load multipe keys into the server. If the ' 2063 'load multipe keys into the server. If the '
2045 'server has multiple keys, it will rotate ' 2064 'server has multiple keys, it will rotate '
2046 'through them in at each request a ' 2065 'through them in at each request a '
2047 'round-robin fashion. The server will ' 2066 'round-robin fashion. The server will '
2048 'generate a random key if none is specified ' 2067 'generate a random key if none is specified '
2049 'on the command line.') 2068 'on the command line.')
2050 2069
2051 2070
2052 if __name__ == '__main__': 2071 if __name__ == '__main__':
2053 sys.exit(ServerRunner().main()) 2072 sys.exit(ServerRunner().main())
OLDNEW
« net/socket/ssl_client_socket_unittest.cc ('K') | « net/socket/ssl_client_socket_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698