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 # Ignore deprecation warnings, they make our output more cluttered. | |
39 # TODO(maruel): warnings.filterwarnings("ignore", category=DeprecationWarning) | |
40 | |
41 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | |
42 ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(BASE_DIR))) | |
43 | |
44 # Append these paths at the the end of sys.path so the system lib will be used b y default. | |
Paweł Hajdan Jr.
2013/11/15 19:34:44
nit: 80 chars
| |
45 sys.path.append(os.path.join(ROOT_DIR, 'third_party', 'pyftpdlib', 'src')) | |
46 sys.path.append(os.path.join(ROOT_DIR, 'third_party', 'tlslite')) | |
Paweł Hajdan Jr.
2013/11/15 19:34:44
The tests don't work with system tlslite. We depen
| |
47 | |
38 import echo_message | 48 import echo_message |
39 import pyftpdlib.ftpserver | 49 import pyftpdlib.ftpserver |
40 import testserver_base | 50 import testserver_base |
41 import tlslite | 51 import tlslite |
42 import tlslite.api | 52 import tlslite.api |
43 | 53 |
44 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | 54 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) |
Paweł Hajdan Jr.
2013/11/15 19:34:44
BASE_DIR is already defined here...
| |
45 sys.path.insert( | 55 sys.path.insert( |
46 0, os.path.join(BASE_DIR, '..', '..', '..', 'third_party/pywebsocket/src')) | 56 0, os.path.join(BASE_DIR, '..', '..', '..', 'third_party/pywebsocket/src')) |
47 from mod_pywebsocket.standalone import WebSocketServer | 57 from mod_pywebsocket.standalone import WebSocketServer |
48 | 58 |
49 SERVER_HTTP = 0 | 59 SERVER_HTTP = 0 |
50 SERVER_FTP = 1 | 60 SERVER_FTP = 1 |
51 SERVER_TCP_ECHO = 2 | 61 SERVER_TCP_ECHO = 2 |
52 SERVER_UDP_ECHO = 3 | 62 SERVER_UDP_ECHO = 3 |
53 SERVER_BASIC_AUTH_PROXY = 4 | 63 SERVER_BASIC_AUTH_PROXY = 4 |
54 SERVER_WEBSOCKET = 5 | 64 SERVER_WEBSOCKET = 5 |
(...skipping 2040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2095 '"aes128", "3des", "rc4". If omitted, all ' | 2105 '"aes128", "3des", "rc4". If omitted, all ' |
2096 'algorithms will be used. This option may ' | 2106 'algorithms will be used. This option may ' |
2097 'appear multiple times, indicating ' | 2107 'appear multiple times, indicating ' |
2098 'multiple algorithms should be enabled.'); | 2108 'multiple algorithms should be enabled.'); |
2099 self.option_parser.add_option('--file-root-url', default='/files/', | 2109 self.option_parser.add_option('--file-root-url', default='/files/', |
2100 help='Specify a root URL for files served.') | 2110 help='Specify a root URL for files served.') |
2101 | 2111 |
2102 | 2112 |
2103 if __name__ == '__main__': | 2113 if __name__ == '__main__': |
2104 sys.exit(ServerRunner().main()) | 2114 sys.exit(ServerRunner().main()) |
OLD | NEW |