Changeset 388 for python/vendor/current/Lib/SimpleHTTPServer.py
- Timestamp:
- Mar 19, 2014, 11:11:30 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/vendor/current/Lib/SimpleHTTPServer.py
r2 r388 16 16 import urllib 17 17 import cgi 18 import sys 18 19 import shutil 19 20 import mimetypes … … 132 133 f.seek(0) 133 134 self.send_response(200) 134 self.send_header("Content-type", "text/html") 135 encoding = sys.getfilesystemencoding() 136 self.send_header("Content-type", "text/html; charset=%s" % encoding) 135 137 self.send_header("Content-Length", str(length)) 136 138 self.end_headers() … … 148 150 path = path.split('?',1)[0] 149 151 path = path.split('#',1)[0] 152 # Don't forget explicit trailing slash when normalizing. Issue17324 153 trailing_slash = path.rstrip().endswith('/') 150 154 path = posixpath.normpath(urllib.unquote(path)) 151 155 words = path.split('/') … … 157 161 if word in (os.curdir, os.pardir): continue 158 162 path = os.path.join(path, word) 163 if trailing_slash: 164 path += '/' 159 165 return path 160 166
Note:
See TracChangeset
for help on using the changeset viewer.