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
485c4b74
Commit
485c4b74
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
f911fe83
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
2 deletions
+11
-2
doc/CHANGES.rst
doc/CHANGES.rst
+1
-1
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 @
485c4b74
...
@@ -8,6 +8,7 @@ http://docs.zope.org/zope2/releases/.
...
@@ -8,6 +8,7 @@ http://docs.zope.org/zope2/releases/.
2.12.26 (unreleased)
2.12.26 (unreleased)
--------------------
--------------------
- LP #930812: Scrub headers a bit more.
2.12.25 (2012-09-18)
2.12.25 (2012-09-18)
--------------------
--------------------
...
@@ -15,7 +16,6 @@ http://docs.zope.org/zope2/releases/.
...
@@ -15,7 +16,6 @@ http://docs.zope.org/zope2/releases/.
- Explicitly declared ZTUtils APIs as public (repairs breakages in apps
- Explicitly declared ZTUtils APIs as public (repairs breakages in apps
following fix for LP #1047318).
following fix for LP #1047318).
2.12.24 (2012-09-09)
2.12.24 (2012-09-09)
--------------------
--------------------
...
...
src/ZPublisher/HTTPResponse.py
View file @
485c4b74
...
@@ -125,7 +125,7 @@ otherTypes = os.environ.get('DONT_GZIP_MAJOR_MIME_TYPES','').lower()
...
@@ -125,7 +125,7 @@ otherTypes = os.environ.get('DONT_GZIP_MAJOR_MIME_TYPES','').lower()
if
otherTypes
:
if
otherTypes
:
uncompressableMimeMajorTypes
+=
tuple
(
otherTypes
.
split
(
','
))
uncompressableMimeMajorTypes
+=
tuple
(
otherTypes
.
split
(
','
))
_CRLF
=
re
.
compile
(
r'
\r[\n]?
'
)
_CRLF
=
re
.
compile
(
r'
[\r\n]
'
)
def
_scrubHeader
(
name
,
value
):
def
_scrubHeader
(
name
,
value
):
return
''
.
join
(
_CRLF
.
split
(
str
(
name
))),
''
.
join
(
_CRLF
.
split
(
str
(
value
)))
return
''
.
join
(
_CRLF
.
split
(
str
(
name
))),
''
.
join
(
_CRLF
.
split
(
str
(
value
)))
...
...
src/ZPublisher/tests/testHTTPResponse.py
View file @
485c4b74
...
@@ -303,6 +303,15 @@ class HTTPResponseTests(unittest.TestCase):
...
@@ -303,6 +303,15 @@ class HTTPResponseTests(unittest.TestCase):
'Set-Cookie: '
'Set-Cookie: '
'violation="http://www.ietf.org/rfc/rfc2616.txt"
\
r
\
n
'
)
'violation="http://www.ietf.org/rfc/rfc2616.txt"
\
r
\
n
'
)
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_setBody_compression_vary
(
self
):
def
test_setBody_compression_vary
(
self
):
# Vary header should be added here
# Vary header should be added here
response
=
self
.
_makeOne
()
response
=
self
.
_makeOne
()
...
...
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