Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3853586e
Commit
3853586e
authored
Mar 17, 2011
by
Senthil Kumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue11442 - Add a charset parameter to the Content-type to avoid XSS attacks.
Patch by Tom N. (Backported from py3k codeline).
parent
6e0a8b8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
Lib/SimpleHTTPServer.py
Lib/SimpleHTTPServer.py
+3
-1
No files found.
Lib/SimpleHTTPServer.py
View file @
3853586e
...
...
@@ -16,6 +16,7 @@ import BaseHTTPServer
import
urllib
import
urlparse
import
cgi
import
sys
import
shutil
import
mimetypes
try
:
...
...
@@ -132,7 +133,8 @@ class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
length
=
f
.
tell
()
f
.
seek
(
0
)
self
.
send_response
(
200
)
self
.
send_header
(
"Content-type"
,
"text/html"
)
encoding
=
sys
.
getfilesystemencoding
()
self
.
send_header
(
"Content-type"
,
"text/html; charset=%s"
%
encoding
)
self
.
send_header
(
"Content-Length"
,
str
(
length
))
self
.
end_headers
()
return
f
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment