| 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 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 | 1527 |
| 1528 ekm = self.server.tlsConnection.exportKeyingMaterial( | 1528 ekm = self.server.tlsConnection.exportKeyingMaterial( |
| 1529 "EXPORTER-Token-Binding", "", False, 32) | 1529 "EXPORTER-Token-Binding", "", False, 32) |
| 1530 self.send_response(200) | 1530 self.send_response(200) |
| 1531 self.send_header('Content-Type', 'application/octet-stream') | 1531 self.send_header('Content-Type', 'application/octet-stream') |
| 1532 self.end_headers() | 1532 self.end_headers() |
| 1533 self.wfile.write(ekm) | 1533 self.wfile.write(ekm) |
| 1534 return True | 1534 return True |
| 1535 | 1535 |
| 1536 def ForwardTokenBindingHeader(self): | 1536 def ForwardTokenBindingHeader(self): |
| 1537 """Send a redirect that sets the Include-Referer-Token-Binding-ID | 1537 """Send a redirect that sets the Include-Referred-Token-Binding-ID |
| 1538 header.""" | 1538 header.""" |
| 1539 | 1539 |
| 1540 test_name = '/forward-tokbind' | 1540 test_name = '/forward-tokbind' |
| 1541 if not self._ShouldHandleRequest(test_name): | 1541 if not self._ShouldHandleRequest(test_name): |
| 1542 return False | 1542 return False |
| 1543 | 1543 |
| 1544 query_char = self.path.find('?') | 1544 query_char = self.path.find('?') |
| 1545 if query_char < 0 or len(self.path) <= query_char + 1: | 1545 if query_char < 0 or len(self.path) <= query_char + 1: |
| 1546 self.sendRedirectHelp(test_name) | 1546 self.sendRedirectHelp(test_name) |
| 1547 return True | 1547 return True |
| 1548 dest = urllib.unquote(self.path[query_char + 1:]) | 1548 dest = urllib.unquote(self.path[query_char + 1:]) |
| 1549 | 1549 |
| 1550 self.send_response(302) | 1550 self.send_response(302) |
| 1551 self.send_header('Location', dest) | 1551 self.send_header('Location', dest) |
| 1552 self.send_header('Include-Referer-Token-Binding-ID', 'true') | 1552 self.send_header('Include-Referred-Token-Binding-ID', 'true') |
| 1553 self.end_headers() | 1553 self.end_headers() |
| 1554 return True | 1554 return True |
| 1555 | 1555 |
| 1556 def GetClientCert(self): | 1556 def GetClientCert(self): |
| 1557 """Send a reply whether a client certificate was provided.""" | 1557 """Send a reply whether a client certificate was provided.""" |
| 1558 | 1558 |
| 1559 if not self._ShouldHandleRequest('/client-cert'): | 1559 if not self._ShouldHandleRequest('/client-cert'): |
| 1560 return False | 1560 return False |
| 1561 | 1561 |
| 1562 self.send_response(200) | 1562 self.send_response(200) |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2198 'an anonymous user.') | 2198 'an anonymous user.') |
| 2199 self.option_parser.add_option('--disable-channel-id', action='store_true') | 2199 self.option_parser.add_option('--disable-channel-id', action='store_true') |
| 2200 self.option_parser.add_option('--disable-extended-master-secret', | 2200 self.option_parser.add_option('--disable-extended-master-secret', |
| 2201 action='store_true') | 2201 action='store_true') |
| 2202 self.option_parser.add_option('--token-binding-params', action='append', | 2202 self.option_parser.add_option('--token-binding-params', action='append', |
| 2203 default=[], type='int') | 2203 default=[], type='int') |
| 2204 | 2204 |
| 2205 | 2205 |
| 2206 if __name__ == '__main__': | 2206 if __name__ == '__main__': |
| 2207 sys.exit(ServerRunner().main()) | 2207 sys.exit(ServerRunner().main()) |
| OLD | NEW |