Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
gevent
Commits
a92e7730
Commit
a92e7730
authored
Aug 13, 2009
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wsgi.py: pulled Mike Barton's patches that fix double content-length bug
parent
62a74d35
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
gevent/wsgi.py
gevent/wsgi.py
+14
-14
No files found.
gevent/wsgi.py
View file @
a92e7730
...
...
@@ -75,7 +75,7 @@ class Input(object):
if
length
is
None
and
self
.
content_length
is
not
None
:
length
=
self
.
content_length
-
self
.
position
if
length
and
self
.
content_length
is
not
None
and
length
>
self
.
content_length
-
self
.
position
:
if
length
and
length
>
self
.
content_length
-
self
.
position
:
length
=
self
.
content_length
-
self
.
position
if
not
length
:
return
''
...
...
@@ -177,8 +177,6 @@ class HttpProtocol(BaseHTTPServer.BaseHTTPRequestHandler):
start
=
time
.
time
()
headers_set
=
[]
headers_sent
=
[]
# set of lowercase header names that were sent
header_dict
=
{}
wfile
=
self
.
wfile
result
=
None
...
...
@@ -193,19 +191,18 @@ class HttpProtocol(BaseHTTPServer.BaseHTTPRequestHandler):
elif
not
headers_sent
:
status
,
response_headers
=
headers_set
headers_sent
.
append
(
1
)
for
k
,
v
in
response_headers
:
header_dict
[
k
.
lower
()]
=
k
header_list
=
[
header
[
0
].
lower
()
for
header
in
response_headers
]
towrite
.
append
(
'%s %s
\
r
\
n
'
%
(
self
.
protocol_version
,
status
))
for
header
in
response_headers
:
towrite
.
append
(
'%s: %s
\
r
\
n
'
%
header
)
# send Date header?
if
'date'
not
in
header_
dic
t
:
if
'date'
not
in
header_
lis
t
:
towrite
.
append
(
'Date: %s
\
r
\
n
'
%
(
format_date_time
(
time
.
time
()),))
if
self
.
request_version
==
'HTTP/1.0'
:
towrite
.
append
(
'Connection: close
\
r
\
n
'
)
self
.
close_connection
=
1
elif
'content-length'
not
in
header_
dic
t
:
elif
'content-length'
not
in
header_
lis
t
:
use_chunked
[
0
]
=
True
towrite
.
append
(
'Transfer-Encoding: chunked
\
r
\
n
'
)
towrite
.
append
(
'
\
r
\
n
'
)
...
...
@@ -249,16 +246,19 @@ class HttpProtocol(BaseHTTPServer.BaseHTTPRequestHandler):
try
:
try
:
result
=
self
.
application
(
self
.
environ
,
start_response
)
if
not
headers_sent
and
hasattr
(
result
,
'__len__'
):
headers_set
[
1
].
append
((
'content-length'
,
str
(
sum
(
map
(
len
,
result
)))))
if
not
headers_sent
and
hasattr
(
result
,
'__len__'
)
and
\
'Content-Length'
not
in
[
h
for
h
,
v
in
headers_set
[
1
]]:
headers_set
[
1
].
append
((
'Content-Length'
,
str
(
sum
(
map
(
len
,
result
)))))
towrite
=
[]
for
data
in
result
:
if
data
:
write
(
data
)
if
not
headers_sent
:
towrite
.
append
(
data
)
if
sum
(
map
(
len
,
towrite
))
>=
self
.
minimum_chunk_size
:
write
(
''
.
join
(
towrite
))
towrite
=
[]
if
towrite
:
write
(
''
.
join
(
towrite
))
if
not
headers_sent
or
use_chunked
[
0
]:
write
(
''
)
if
use_chunked
[
0
]:
wfile
.
write
(
'0
\
r
\
n
\
r
\
n
'
)
except
Exception
,
e
:
self
.
close_connection
=
1
exc
=
traceback
.
format_exc
()
...
...
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