| OLD | NEW |
| 1 # Copyright (c) 2011 Google Inc. All rights reserved. | 1 # Copyright (c) 2011 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | 28 |
| 29 import BaseHTTPServer | 29 import BaseHTTPServer |
| 30 | 30 |
| 31 import cgi | 31 import cgi |
| 32 import codecs | 32 import codecs |
| 33 import datetime | 33 import datetime |
| 34 import fnmatch | |
| 35 import json | 34 import json |
| 36 import mimetypes | 35 import mimetypes |
| 37 import os.path | 36 import os.path |
| 38 import shutil | 37 import shutil |
| 39 import threading | 38 import threading |
| 40 import time | 39 import time |
| 41 import urlparse | |
| 42 import wsgiref.handlers | 40 import wsgiref.handlers |
| 43 import BaseHTTPServer | 41 import BaseHTTPServer |
| 44 | 42 |
| 45 | 43 |
| 46 class ReflectionHandler(BaseHTTPServer.BaseHTTPRequestHandler): | 44 class ReflectionHandler(BaseHTTPServer.BaseHTTPRequestHandler): |
| 47 STATIC_FILE_EXTENSIONS = ['.js', '.css', '.html'] | 45 STATIC_FILE_EXTENSIONS = ['.js', '.css', '.html'] |
| 48 # Subclasses should override. | 46 # Subclasses should override. |
| 49 STATIC_FILE_DIRECTORY = None | 47 STATIC_FILE_DIRECTORY = None |
| 50 | 48 |
| 51 # Setting this flag to True causes the server to send | 49 # Setting this flag to True causes the server to send |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 if not headers_only: | 141 if not headers_only: |
| 144 shutil.copyfileobj(static_file, self.wfile) | 142 shutil.copyfileobj(static_file, self.wfile) |
| 145 | 143 |
| 146 def _serve_xml(self, xml): | 144 def _serve_xml(self, xml): |
| 147 self.send_response(200) | 145 self.send_response(200) |
| 148 self._send_access_control_header() | 146 self._send_access_control_header() |
| 149 self.send_header("Content-type", "text/xml") | 147 self.send_header("Content-type", "text/xml") |
| 150 self.end_headers() | 148 self.end_headers() |
| 151 xml = xml.encode('utf-8') | 149 xml = xml.encode('utf-8') |
| 152 self.wfile.write(xml) | 150 self.wfile.write(xml) |
| OLD | NEW |