| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 self.ssl_client_cas.append(x509.subject) | 186 self.ssl_client_cas.append(x509.subject) |
| 187 | 187 |
| 188 for cert_type in ssl_client_cert_types: | 188 for cert_type in ssl_client_cert_types: |
| 189 self.ssl_client_cert_types.append({ | 189 self.ssl_client_cert_types.append({ |
| 190 "rsa_sign": tlslite.api.ClientCertificateType.rsa_sign, | 190 "rsa_sign": tlslite.api.ClientCertificateType.rsa_sign, |
| 191 "dss_sign": tlslite.api.ClientCertificateType.dss_sign, | 191 "dss_sign": tlslite.api.ClientCertificateType.dss_sign, |
| 192 "ecdsa_sign": tlslite.api.ClientCertificateType.ecdsa_sign, | 192 "ecdsa_sign": tlslite.api.ClientCertificateType.ecdsa_sign, |
| 193 }[cert_type]) | 193 }[cert_type]) |
| 194 | 194 |
| 195 self.ssl_handshake_settings = tlslite.api.HandshakeSettings() | 195 self.ssl_handshake_settings = tlslite.api.HandshakeSettings() |
| 196 # Enable SSLv3 for testing purposes. |
| 197 self.ssl_handshake_settings.minVersion = (3, 0) |
| 196 if ssl_bulk_ciphers is not None: | 198 if ssl_bulk_ciphers is not None: |
| 197 self.ssl_handshake_settings.cipherNames = ssl_bulk_ciphers | 199 self.ssl_handshake_settings.cipherNames = ssl_bulk_ciphers |
| 198 if ssl_key_exchanges is not None: | 200 if ssl_key_exchanges is not None: |
| 199 self.ssl_handshake_settings.keyExchangeNames = ssl_key_exchanges | 201 self.ssl_handshake_settings.keyExchangeNames = ssl_key_exchanges |
| 200 if tls_intolerant != 0: | 202 if tls_intolerant != 0: |
| 201 self.ssl_handshake_settings.tlsIntolerant = (3, tls_intolerant) | 203 self.ssl_handshake_settings.tlsIntolerant = (3, tls_intolerant) |
| 202 self.ssl_handshake_settings.tlsIntoleranceType = tls_intolerance_type | 204 self.ssl_handshake_settings.tlsIntoleranceType = tls_intolerance_type |
| 203 | 205 |
| 204 | 206 |
| 205 if disable_session_cache: | 207 if disable_session_cache: |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 self.rfile.read(2) | 669 self.rfile.read(2) |
| 668 return body | 670 return body |
| 669 | 671 |
| 670 def EchoHandler(self): | 672 def EchoHandler(self): |
| 671 """This handler just echoes back the payload of the request, for testing | 673 """This handler just echoes back the payload of the request, for testing |
| 672 form submission.""" | 674 form submission.""" |
| 673 | 675 |
| 674 if not self._ShouldHandleRequest("/echo"): | 676 if not self._ShouldHandleRequest("/echo"): |
| 675 return False | 677 return False |
| 676 | 678 |
| 677 self.send_response(200) | 679 _, _, _, _, query, _ = urlparse.urlparse(self.path) |
| 680 query_params = cgi.parse_qs(query, True) |
| 681 if 'status' in query_params: |
| 682 self.send_response(int(query_params['status'][0])) |
| 683 else: |
| 684 self.send_response(200) |
| 678 self.send_header('Content-Type', 'text/html') | 685 self.send_header('Content-Type', 'text/html') |
| 679 self.end_headers() | 686 self.end_headers() |
| 680 self.wfile.write(self.ReadRequestBody()) | 687 self.wfile.write(self.ReadRequestBody()) |
| 681 return True | 688 return True |
| 682 | 689 |
| 683 def EchoTitleHandler(self): | 690 def EchoTitleHandler(self): |
| 684 """This handler is like Echo, but sets the page title to the request.""" | 691 """This handler is like Echo, but sets the page title to the request.""" |
| 685 | 692 |
| 686 if not self._ShouldHandleRequest("/echotitle"): | 693 if not self._ShouldHandleRequest("/echotitle"): |
| 687 return False | 694 return False |
| (...skipping 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2276 self.option_parser.add_option('--ocsp-server-unavailable', | 2283 self.option_parser.add_option('--ocsp-server-unavailable', |
| 2277 dest='ocsp_server_unavailable', | 2284 dest='ocsp_server_unavailable', |
| 2278 default=False, action='store_true', | 2285 default=False, action='store_true', |
| 2279 help='If set, the OCSP server will return ' | 2286 help='If set, the OCSP server will return ' |
| 2280 'a tryLater status rather than the actual ' | 2287 'a tryLater status rather than the actual ' |
| 2281 'OCSP response.') | 2288 'OCSP response.') |
| 2282 | 2289 |
| 2283 | 2290 |
| 2284 if __name__ == '__main__': | 2291 if __name__ == '__main__': |
| 2285 sys.exit(ServerRunner().main()) | 2292 sys.exit(ServerRunner().main()) |
| OLD | NEW |