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
79a25437
Commit
79a25437
authored
Dec 01, 2009
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wsgi: add SERVER_SOFTWARE in environ; use it for Server header
- the default value is "gevent x.y Python x.y"
parent
d4a12a83
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
gevent/wsgi.py
gevent/wsgi.py
+12
-5
No files found.
gevent/wsgi.py
View file @
79a25437
...
...
@@ -2,9 +2,11 @@ import sys
import
traceback
from
urllib
import
unquote
from
datetime
import
datetime
from
gevent.http
import
HTTPServer
socket
=
__import__
(
'socket'
)
import
gevent
from
gevent.http
import
HTTPServer
__all__
=
[
'WSGIServer'
,
'WSGIHandler'
]
...
...
@@ -32,7 +34,7 @@ class WSGIHandler(object):
def
write
(
self
,
data
):
self
.
data
.
append
(
data
)
def
end
(
self
):
def
end
(
self
,
env
):
assert
self
.
headers
is
not
None
,
'Application did not call start_response'
has_content_length
=
False
for
k
,
v
in
self
.
headers
:
...
...
@@ -51,6 +53,10 @@ class WSGIHandler(object):
# QQQ end of work around
# QQQ when this is fixed, add version guard
SERVER_SOFTWARE
=
env
.
get
(
'SERVER_SOFTWARE'
)
if
SERVER_SOFTWARE
and
not
self
.
request
.
find_output_header
(
'Server'
):
self
.
request
.
add_output_header
(
'Server'
,
SERVER_SOFTWARE
)
self
.
send_reply
(
self
.
code
,
self
.
reason
,
data
)
def
send_reply
(
self
,
code
,
reason
,
data
):
...
...
@@ -110,15 +116,16 @@ class WSGIHandler(object):
return
finally
:
if
self
is
not
None
:
self
.
end
()
self
.
end
(
env
)
class
WSGIServer
(
HTTPServer
):
handler_class
=
WSGIHandler
base_env
=
{
'SCRIPT_NAME'
:
''
,
'GATEWAY_INTERFACE'
:
'CGI/1.1'
,
base_env
=
{
'GATEWAY_INTERFACE'
:
'CGI/1.1'
,
'SERVER_SOFTWARE'
:
'gevent/%d.%d Python/%d.%d'
%
(
gevent
.
version_info
[:
2
]
+
sys
.
version_info
[:
2
]),
'SCRIPT_NAME'
:
''
,
'wsgi.version'
:
(
1
,
0
),
'wsgi.url_scheme'
:
'http'
,
'wsgi.errors'
:
sys
.
stderr
,
...
...
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