| 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 17 matching lines...) Expand all Loading... |
| 28 import socket | 28 import socket |
| 29 import SocketServer | 29 import SocketServer |
| 30 import struct | 30 import struct |
| 31 import sys | 31 import sys |
| 32 import threading | 32 import threading |
| 33 import time | 33 import time |
| 34 import urllib | 34 import urllib |
| 35 import urlparse | 35 import urlparse |
| 36 import zlib | 36 import zlib |
| 37 | 37 |
| 38 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 39 ROOT_DIR = os.path.dirname( |
| 40 os.path.dirname(os.path.dirname(os.path.dirname(BASE_DIR)))) |
| 41 |
| 42 # Insert at the beginning of the path, we want these to be used |
| 43 # unconditionally. |
| 44 sys.path.insert(0, os.path.join(ROOT_DIR, 'third_party', 'tlslite')) |
| 45 sys.path.insert(0, os.path.join(ROOT_DIR, 'third_party', 'pyftpdlib', 'src')) |
| 46 sys.path.insert(0, os.path.join(ROOT_DIR, 'third_party', 'pywebsocket', 'src')) |
| 38 import echo_message | 47 import echo_message |
| 39 import pyftpdlib.ftpserver | 48 import pyftpdlib.ftpserver |
| 40 import testserver_base | 49 import testserver_base |
| 41 import tlslite | 50 import tlslite |
| 42 import tlslite.api | 51 import tlslite.api |
| 43 | 52 |
| 44 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | |
| 45 sys.path.insert( | |
| 46 0, os.path.join(BASE_DIR, '..', '..', '..', 'third_party/pywebsocket/src')) | |
| 47 from mod_pywebsocket.standalone import WebSocketServer | 53 from mod_pywebsocket.standalone import WebSocketServer |
| 48 | 54 |
| 49 SERVER_HTTP = 0 | 55 SERVER_HTTP = 0 |
| 50 SERVER_FTP = 1 | 56 SERVER_FTP = 1 |
| 51 SERVER_TCP_ECHO = 2 | 57 SERVER_TCP_ECHO = 2 |
| 52 SERVER_UDP_ECHO = 3 | 58 SERVER_UDP_ECHO = 3 |
| 53 SERVER_BASIC_AUTH_PROXY = 4 | 59 SERVER_BASIC_AUTH_PROXY = 4 |
| 54 SERVER_WEBSOCKET = 5 | 60 SERVER_WEBSOCKET = 5 |
| 55 | 61 |
| 56 # Default request queue size for WebSocketServer. | 62 # Default request queue size for WebSocketServer. |
| (...skipping 2052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2109 '"aes128", "3des", "rc4". If omitted, all ' | 2115 '"aes128", "3des", "rc4". If omitted, all ' |
| 2110 'algorithms will be used. This option may ' | 2116 'algorithms will be used. This option may ' |
| 2111 'appear multiple times, indicating ' | 2117 'appear multiple times, indicating ' |
| 2112 'multiple algorithms should be enabled.'); | 2118 'multiple algorithms should be enabled.'); |
| 2113 self.option_parser.add_option('--file-root-url', default='/files/', | 2119 self.option_parser.add_option('--file-root-url', default='/files/', |
| 2114 help='Specify a root URL for files served.') | 2120 help='Specify a root URL for files served.') |
| 2115 | 2121 |
| 2116 | 2122 |
| 2117 if __name__ == '__main__': | 2123 if __name__ == '__main__': |
| 2118 sys.exit(ServerRunner().main()) | 2124 sys.exit(ServerRunner().main()) |
| OLD | NEW |