Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
382c95ae
Commit
382c95ae
authored
Oct 14, 2012
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LP #930812: Scrub headers a bit more.
parent
bc4a283c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
1 deletion
+12
-1
doc/CHANGES.rst
doc/CHANGES.rst
+2
-0
src/ZPublisher/HTTPResponse.py
src/ZPublisher/HTTPResponse.py
+1
-1
src/ZPublisher/tests/testHTTPResponse.py
src/ZPublisher/tests/testHTTPResponse.py
+9
-0
No files found.
doc/CHANGES.rst
View file @
382c95ae
...
...
@@ -8,6 +8,8 @@ http://docs.zope.org/zope2/releases/.
2.13.19 (unreleased)
--------------------
- LP #930812: Scrub headers a bit more.
- Updated distributions:
- tempstorage = 2.12.2
...
...
src/ZPublisher/HTTPResponse.py
View file @
382c95ae
...
...
@@ -128,7 +128,7 @@ otherTypes = os.environ.get('DONT_GZIP_MAJOR_MIME_TYPES','').lower()
if
otherTypes
:
uncompressableMimeMajorTypes
+=
tuple
(
otherTypes
.
split
(
','
))
_CRLF
=
re
.
compile
(
r'
\r[\n]?
'
)
_CRLF
=
re
.
compile
(
r'
[\r\n]
'
)
def
_scrubHeader
(
name
,
value
):
return
''
.
join
(
_CRLF
.
split
(
str
(
name
))),
''
.
join
(
_CRLF
.
split
(
str
(
value
)))
...
...
src/ZPublisher/tests/testHTTPResponse.py
View file @
382c95ae
...
...
@@ -431,6 +431,15 @@ class HTTPResponseTests(unittest.TestCase):
(
'Set-Cookie'
,
'violation="http://www.ietf.org/rfc/rfc2616.txt"'
)])
def
test_setHeader_drops_LF
(
self
):
# Some browsers accept \n in place of \n\r to separate headers,
# so we scrub it too.
response
=
self
.
_makeOne
()
response
.
setHeader
(
'Location'
,
'http://www.ietf.org/rfc/
\
n
rfc2616.txt'
)
self
.
assertEqual
(
response
.
headers
[
'location'
],
'http://www.ietf.org/rfc/rfc2616.txt'
)
def
test_appendHeader_no_existing
(
self
):
response
=
self
.
_makeOne
()
response
.
appendHeader
(
'foo'
,
'foo'
)
...
...
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