| OLD | NEW |
| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 self.AuthBasicHandler, | 267 self.AuthBasicHandler, |
| 268 self.AuthDigestHandler, | 268 self.AuthDigestHandler, |
| 269 self.SlowServerHandler, | 269 self.SlowServerHandler, |
| 270 self.ChunkedServerHandler, | 270 self.ChunkedServerHandler, |
| 271 self.ContentTypeHandler, | 271 self.ContentTypeHandler, |
| 272 self.NoContentHandler, | 272 self.NoContentHandler, |
| 273 self.ServerRedirectHandler, | 273 self.ServerRedirectHandler, |
| 274 self.ClientRedirectHandler, | 274 self.ClientRedirectHandler, |
| 275 self.MultipartHandler, | 275 self.MultipartHandler, |
| 276 self.GetSSLSessionCacheHandler, | 276 self.GetSSLSessionCacheHandler, |
| 277 self.GetSSLClientHelloSizeHandler, |
| 277 self.SSLManySmallRecords, | 278 self.SSLManySmallRecords, |
| 278 self.GetChannelID, | 279 self.GetChannelID, |
| 279 self.CloseSocketHandler, | 280 self.CloseSocketHandler, |
| 280 self.RangeResetHandler, | 281 self.RangeResetHandler, |
| 281 self.DefaultResponseHandler] | 282 self.DefaultResponseHandler] |
| 282 post_handlers = [ | 283 post_handlers = [ |
| 283 self.EchoTitleHandler, | 284 self.EchoTitleHandler, |
| 284 self.EchoHandler, | 285 self.EchoHandler, |
| 285 self.PostOnlyFileHandler] + get_handlers | 286 self.PostOnlyFileHandler] + get_handlers |
| 286 put_handlers = [ | 287 put_handlers = [ |
| (...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 self.send_header('Content-Type', 'text/plain') | 1383 self.send_header('Content-Type', 'text/plain') |
| 1383 self.end_headers() | 1384 self.end_headers() |
| 1384 try: | 1385 try: |
| 1385 for (action, sessionID) in self.server.session_cache.log: | 1386 for (action, sessionID) in self.server.session_cache.log: |
| 1386 self.wfile.write('%s\t%s\n' % (action, sessionID.encode('hex'))) | 1387 self.wfile.write('%s\t%s\n' % (action, sessionID.encode('hex'))) |
| 1387 except AttributeError: | 1388 except AttributeError: |
| 1388 self.wfile.write('Pass --https-record-resume in order to use' + | 1389 self.wfile.write('Pass --https-record-resume in order to use' + |
| 1389 ' this request') | 1390 ' this request') |
| 1390 return True | 1391 return True |
| 1391 | 1392 |
| 1393 def GetSSLClientHelloSizeHandler(self): |
| 1394 """Send a reply containing the length of the ClientHello record.""" |
| 1395 |
| 1396 if not self._ShouldHandleRequest('/client-hello-length'): |
| 1397 return False |
| 1398 |
| 1399 self.send_response(200) |
| 1400 self.send_header('Content-Type', 'text/plain') |
| 1401 self.end_headers() |
| 1402 |
| 1403 self.wfile.write('%d' % self.server.tlsConnection.client_hello_length) |
| 1404 |
| 1405 return True |
| 1406 |
| 1392 def SSLManySmallRecords(self): | 1407 def SSLManySmallRecords(self): |
| 1393 """Sends a reply consisting of a variety of small writes. These will be | 1408 """Sends a reply consisting of a variety of small writes. These will be |
| 1394 translated into a series of small SSL records when used over an HTTPS | 1409 translated into a series of small SSL records when used over an HTTPS |
| 1395 server.""" | 1410 server.""" |
| 1396 | 1411 |
| 1397 if not self._ShouldHandleRequest('/ssl-many-small-records'): | 1412 if not self._ShouldHandleRequest('/ssl-many-small-records'): |
| 1398 return False | 1413 return False |
| 1399 | 1414 |
| 1400 self.send_response(200) | 1415 self.send_response(200) |
| 1401 self.send_header('Content-Type', 'text/plain') | 1416 self.send_header('Content-Type', 'text/plain') |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2056 '"aes128", "3des", "rc4". If omitted, all ' | 2071 '"aes128", "3des", "rc4". If omitted, all ' |
| 2057 'algorithms will be used. This option may ' | 2072 'algorithms will be used. This option may ' |
| 2058 'appear multiple times, indicating ' | 2073 'appear multiple times, indicating ' |
| 2059 'multiple algorithms should be enabled.'); | 2074 'multiple algorithms should be enabled.'); |
| 2060 self.option_parser.add_option('--file-root-url', default='/files/', | 2075 self.option_parser.add_option('--file-root-url', default='/files/', |
| 2061 help='Specify a root URL for files served.') | 2076 help='Specify a root URL for files served.') |
| 2062 | 2077 |
| 2063 | 2078 |
| 2064 if __name__ == '__main__': | 2079 if __name__ == '__main__': |
| 2065 sys.exit(ServerRunner().main()) | 2080 sys.exit(ServerRunner().main()) |
| OLD | NEW |