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
b715fac8
Commit
b715fac8
authored
Jan 06, 2011
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #3839: wsgiref should not override a Content-Length header set by
the application. Initial patch by Clovis Fabricio.
parent
f1397ad3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
5 deletions
+18
-5
Lib/test/test_wsgiref.py
Lib/test/test_wsgiref.py
+11
-4
Lib/wsgiref/handlers.py
Lib/wsgiref/handlers.py
+3
-1
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_wsgiref.py
View file @
b715fac8
...
...
@@ -520,6 +520,11 @@ class HandlerTests(TestCase):
s
(
'200 OK'
,[])
return
[
'
\
u0442
\
u0435
\
u0441
\
u0442
'
.
encode
(
"utf-8"
)]
def
trivial_app4
(
e
,
s
):
# Simulate a response to a HEAD request
s
(
'200 OK'
,[(
'Content-Length'
,
'12345'
)])
return
[]
h
=
TestHandler
()
h
.
run
(
trivial_app1
)
self
.
assertEqual
(
h
.
stdout
.
getvalue
(),
...
...
@@ -543,10 +548,12 @@ class HandlerTests(TestCase):
b'
\
r
\
n
'
b'
\
xd1
\
x82
\
xd0
\
xb5
\
xd1
\
x81
\
xd1
\
x82
'
)
h
=
TestHandler
()
h
.
run
(
trivial_app4
)
self
.
assertEqual
(
h
.
stdout
.
getvalue
(),
b'Status: 200 OK
\
r
\
n
'
b'Content-Length: 12345
\
r
\
n
'
b'
\
r
\
n
'
)
def
testBasicErrorOutput
(
self
):
...
...
Lib/wsgiref/handlers.py
View file @
b715fac8
...
...
@@ -302,7 +302,9 @@ class BaseHandler:
def
finish_content
(
self
):
"""Ensure headers and content have both been sent"""
if
not
self
.
headers_sent
:
self
.
headers
[
'Content-Length'
]
=
"0"
# Only zero Content-Length if not set by the application (so
# that HEAD requests can be satisfied properly, see #3839)
self
.
headers
.
setdefault
(
'Content-Length'
,
"0"
)
self
.
send_headers
()
else
:
pass
# XXX check if content-length was too short?
...
...
Misc/ACKS
View file @
b715fac8
...
...
@@ -261,6 +261,7 @@ Paul Everitt
David Everly
Greg Ewing
Martijn Faassen
Clovis Fabricio
Andreas Faerber
Bill Fancher
Troy J. Farrell
...
...
Misc/NEWS
View file @
b715fac8
...
...
@@ -30,6 +30,9 @@ Core and Builtins
Library
-------
- Issue #3839: wsgiref should not override a Content-Length header set by
the application. Initial patch by Clovis Fabricio.
- Issue #10492: bdb.Bdb.run() only traces the execution of the code, not the
compilation (if the input is a string).
...
...
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