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
198f2398
Commit
198f2398
authored
Feb 07, 2014
by
Fantix King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refs #38, fix pywsgi headers issue in PY3
parent
b48db7d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
2 deletions
+34
-2
gevent/pywsgi.py
gevent/pywsgi.py
+34
-2
No files found.
gevent/pywsgi.py
View file @
198f2398
...
...
@@ -5,7 +5,6 @@ import errno
import
sys
import
time
import
traceback
import
mimetools
from
datetime
import
datetime
from
urllib
import
unquote
...
...
@@ -163,9 +162,42 @@ class Input(object):
return
line
try
:
import
mimetools
headers_factory
=
mimetools
.
Message
except
ImportError
:
# adapt Python 3 HTTP headers to old API
from
http
import
client
class
OldMessage
(
client
.
HTTPMessage
):
def
__init__
(
self
,
**
kwargs
):
super
().
__init__
(
**
kwargs
)
self
.
status
=
''
def
getheader
(
self
,
name
,
default
=
None
):
return
self
.
get
(
name
,
default
)
@
property
def
headers
(
self
):
for
key
,
value
in
self
.
_headers
:
yield
'%s: %s
\
r
\
n
'
%
(
key
,
value
)
@
property
def
typeheader
(
self
):
return
self
.
get
(
'content-type'
)
def
headers_factory
(
fp
,
*
args
):
try
:
ret
=
client
.
parse_headers
(
fp
,
_class
=
OldMessage
)
except
client
.
LineTooLong
:
ret
=
OldMessage
()
ret
.
status
=
'Line too long'
return
ret
class
WSGIHandler
(
object
):
protocol_version
=
'HTTP/1.1'
MessageClass
=
mimetools
.
Message
MessageClass
=
headers_factory
def
__init__
(
self
,
socket
,
address
,
server
,
rfile
=
None
):
self
.
socket
=
socket
...
...
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