OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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/SYNC/TCP/UDP/ server used for testing Chrome. | 6 """This is a simple HTTP/FTP/SYNC/TCP/UDP/ server used for testing Chrome. |
7 | 7 |
8 It supports several test URLs, as specified by the handlers in TestPageHandler. | 8 It supports several test URLs, as specified by the handlers in TestPageHandler. |
9 By default, it listens on an ephemeral port and sends the port number back to | 9 By default, it listens on an ephemeral port and sends the port number back to |
10 the originating process over a pipe. The originating process can specify an | 10 the originating process over a pipe. The originating process can specify an |
(...skipping 19 matching lines...) Expand all Loading... |
30 import socket | 30 import socket |
31 import SocketServer | 31 import SocketServer |
32 import sys | 32 import sys |
33 import threading | 33 import threading |
34 import time | 34 import time |
35 import urllib | 35 import urllib |
36 import urlparse | 36 import urlparse |
37 import zlib | 37 import zlib |
38 | 38 |
39 import echo_message | 39 import echo_message |
40 from mod_pywebsocket.standalone import WebSocketServer | |
41 import pyftpdlib.ftpserver | 40 import pyftpdlib.ftpserver |
42 import testserver_base | 41 import testserver_base |
43 import tlslite | 42 import tlslite |
44 import tlslite.api | 43 import tlslite.api |
45 | 44 |
46 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | 45 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 46 sys.path.insert( |
| 47 0, os.path.join(BASE_DIR, '..', '..', '..', 'third_party/pywebsocket/src')) |
| 48 from mod_pywebsocket.standalone import WebSocketServer |
47 | 49 |
48 SERVER_HTTP = 0 | 50 SERVER_HTTP = 0 |
49 SERVER_FTP = 1 | 51 SERVER_FTP = 1 |
50 SERVER_SYNC = 2 | 52 SERVER_SYNC = 2 |
51 SERVER_TCP_ECHO = 3 | 53 SERVER_TCP_ECHO = 3 |
52 SERVER_UDP_ECHO = 4 | 54 SERVER_UDP_ECHO = 4 |
53 SERVER_BASIC_AUTH_PROXY = 5 | 55 SERVER_BASIC_AUTH_PROXY = 5 |
54 SERVER_WEBSOCKET = 6 | 56 SERVER_WEBSOCKET = 6 |
55 | 57 |
56 # Default request queue size for WebSocketServer. | 58 # Default request queue size for WebSocketServer. |
(...skipping 2374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2431 'should report back to the client as the ' | 2433 'should report back to the client as the ' |
2432 'user owning the token used for making the ' | 2434 'user owning the token used for making the ' |
2433 'policy request.') | 2435 'policy request.') |
2434 self.option_parser.add_option('--auth-token', dest='auth_token', | 2436 self.option_parser.add_option('--auth-token', dest='auth_token', |
2435 help='Specify the auth token which should be ' | 2437 help='Specify the auth token which should be ' |
2436 'used in the authorization header for GData.') | 2438 'used in the authorization header for GData.') |
2437 | 2439 |
2438 | 2440 |
2439 if __name__ == '__main__': | 2441 if __name__ == '__main__': |
2440 sys.exit(ServerRunner().main()) | 2442 sys.exit(ServerRunner().main()) |
OLD | NEW |