OLD | NEW |
1 #!/usr/bin/env python | 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 # | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # Copyright 2010 Google Inc. All Rights Reserved. | 3 # found in the LICENSE file. |
4 | |
5 """HTTP proxy request handler with SSL support. | 4 """HTTP proxy request handler with SSL support. |
6 | 5 |
7 RequestHandler: Utility class for parsing HTTP requests. | 6 RequestHandler: Utility class for parsing HTTP requests. |
8 ProxyHandler: HTTP proxy handler. | 7 ProxyHandler: HTTP proxy handler. |
9 """ | 8 """ |
10 | 9 |
11 import BaseHTTPServer | 10 import BaseHTTPServer |
12 import cgi | 11 import cgi |
13 import OpenSSL | 12 import OpenSSL |
14 import os | 13 import os |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 BaseHTTPServer.HTTPServer): | 113 BaseHTTPServer.HTTPServer): |
115 pass | 114 pass |
116 | 115 |
117 | 116 |
118 def CreateServer(driver, port, certificate_directory=None): | 117 def CreateServer(driver, port, certificate_directory=None): |
119 if not certificate_directory: | 118 if not certificate_directory: |
120 certificate_directory = os.path.join(os.getcwd(), 'certificates') | 119 certificate_directory = os.path.join(os.getcwd(), 'certificates') |
121 ProxyHandler.driver = driver | 120 ProxyHandler.driver = driver |
122 ProxyHandler.certificate_directory = certificate_directory | 121 ProxyHandler.certificate_directory = certificate_directory |
123 return ThreadingHTTPServer(('', port), ProxyHandler) | 122 return ThreadingHTTPServer(('', port), ProxyHandler) |
OLD | NEW |