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 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 return True | 1421 return True |
1422 | 1422 |
1423 def CrossSiteRedirectHandler(self): | 1423 def CrossSiteRedirectHandler(self): |
1424 """Sends a server redirect to the given site. The syntax is | 1424 """Sends a server redirect to the given site. The syntax is |
1425 '/cross-site/hostname/...' to redirect to //hostname/... | 1425 '/cross-site/hostname/...' to redirect to //hostname/... |
1426 It is used to navigate between different Sites, causing | 1426 It is used to navigate between different Sites, causing |
1427 cross-site/cross-process navigations in the browser.""" | 1427 cross-site/cross-process navigations in the browser.""" |
1428 | 1428 |
1429 test_name = "/cross-site" | 1429 test_name = "/cross-site" |
1430 if not self._ShouldHandleRequest(test_name): | 1430 if not self._ShouldHandleRequest(test_name): |
1431 print "CSRH: not handling request for " + test_name | |
1432 return False | 1431 return False |
1433 | 1432 |
1434 params = urllib.unquote(self.path[(len(test_name) + 1):]) | 1433 params = urllib.unquote(self.path[(len(test_name) + 1):]) |
1435 slash = params.find('/') | 1434 slash = params.find('/') |
1436 if slash < 0: | 1435 if slash < 0: |
1437 self.sendRedirectHelp(test_name) | 1436 self.sendRedirectHelp(test_name) |
1438 return True | 1437 return True |
1439 | 1438 |
1440 host = params[:slash] | 1439 host = params[:slash] |
1441 path = params[(slash+1):] | 1440 path = params[(slash+1):] |
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2267 self.option_parser.add_option('--file-root-url', default='/files/', | 2266 self.option_parser.add_option('--file-root-url', default='/files/', |
2268 help='Specify a root URL for files served.') | 2267 help='Specify a root URL for files served.') |
2269 # TODO(ricea): Generalize this to support basic auth for HTTP too. | 2268 # TODO(ricea): Generalize this to support basic auth for HTTP too. |
2270 self.option_parser.add_option('--ws-basic-auth', action='store_true', | 2269 self.option_parser.add_option('--ws-basic-auth', action='store_true', |
2271 dest='ws_basic_auth', | 2270 dest='ws_basic_auth', |
2272 help='Enable basic-auth for WebSocket') | 2271 help='Enable basic-auth for WebSocket') |
2273 | 2272 |
2274 | 2273 |
2275 if __name__ == '__main__': | 2274 if __name__ == '__main__': |
2276 sys.exit(ServerRunner().main()) | 2275 sys.exit(ServerRunner().main()) |
OLD | NEW |