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
5ef4fc24
Commit
5ef4fc24
authored
Dec 25, 2018
by
Cheryl Sabella
Committed by
Raymond Hettinger
Dec 25, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-35565: Add detail to assertion failure message in wsgiref (GH-11293)
parent
32d96a2b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
Lib/test/test_wsgiref.py
Lib/test/test_wsgiref.py
+13
-0
Lib/wsgiref/handlers.py
Lib/wsgiref/handlers.py
+2
-1
No files found.
Lib/test/test_wsgiref.py
View file @
5ef4fc24
...
...
@@ -193,6 +193,19 @@ class IntegrationTests(TestCase):
))
self
.
assertEqual
(
err
.
splitlines
()[
-
2
],
exc_message
)
@
unittest
.
skipIf
(
support
.
python_is_optimized
(),
"Python was compiled with optimizations"
)
def
test_hop_by_hop_validation_error
(
self
):
def
bad_app
(
environ
,
start_response
):
start_response
(
"200 OK"
,
[(
'Content-Type'
,
'text/plain'
),
(
'Connection'
,
'close'
)])
return
[
"Hello, world!"
]
out
,
err
=
run_amock
(
bad_app
)
self
.
assertTrue
(
out
.
endswith
(
b"A server error occurred. Please contact the administrator."
))
self
.
assertRaises
(
AssertionError
)
def
test_wsgi_input
(
self
):
def
bad_app
(
e
,
s
):
e
[
"wsgi.input"
].
read
()
...
...
Lib/wsgiref/handlers.py
View file @
5ef4fc24
...
...
@@ -233,7 +233,8 @@ class BaseHandler:
for
name
,
val
in
headers
:
name
=
self
.
_convert_string_type
(
name
,
"Header name"
)
val
=
self
.
_convert_string_type
(
val
,
"Header value"
)
assert
not
is_hop_by_hop
(
name
),
"Hop-by-hop headers not allowed"
assert
not
is_hop_by_hop
(
name
),
\
f"Hop-by-hop header, '
{
name
}
:
{
val
}
', not allowed"
return
self
.
write
...
...
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