mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Add SERVER_SOFTWARE to the os.environ
Requested to allow a WSGI app to detect if its running in production or development modes.
This commit is contained in:
parent
995d060384
commit
3cc0e5df8a
@ -25,3 +25,4 @@ else:
|
|||||||
|
|
||||||
version_info = (0, 11, "1%s" % minor_tag)
|
version_info = (0, 11, "1%s" % minor_tag)
|
||||||
__version__ = ".".join(map(str, version_info))
|
__version__ = ".".join(map(str, version_info))
|
||||||
|
SERVER_SOFTWARE = "gunicorn/%s" % __version__
|
||||||
|
|||||||
@ -18,7 +18,8 @@ from gunicorn.errors import HaltServer
|
|||||||
from gunicorn.pidfile import Pidfile
|
from gunicorn.pidfile import Pidfile
|
||||||
from gunicorn.sock import create_socket
|
from gunicorn.sock import create_socket
|
||||||
from gunicorn import util
|
from gunicorn import util
|
||||||
from gunicorn import __version__
|
|
||||||
|
from gunicorn import __version__, SERVER_SOFTWARE
|
||||||
|
|
||||||
class Arbiter(object):
|
class Arbiter(object):
|
||||||
"""
|
"""
|
||||||
@ -53,6 +54,8 @@ class Arbiter(object):
|
|||||||
self.log = logging.getLogger(__name__)
|
self.log = logging.getLogger(__name__)
|
||||||
self.log.info("Starting gunicorn %s" % __version__)
|
self.log.info("Starting gunicorn %s" % __version__)
|
||||||
|
|
||||||
|
os.environ["SERVER_SOFTWARE"] = SERVER_SOFTWARE
|
||||||
|
|
||||||
self.setup(app)
|
self.setup(app)
|
||||||
|
|
||||||
self.pidfile = None
|
self.pidfile = None
|
||||||
|
|||||||
@ -9,10 +9,9 @@ import re
|
|||||||
import sys
|
import sys
|
||||||
from urllib import unquote
|
from urllib import unquote
|
||||||
|
|
||||||
from gunicorn import __version__
|
from gunicorn import SERVER_SOFTWARE
|
||||||
import gunicorn.util as util
|
import gunicorn.util as util
|
||||||
|
|
||||||
SERVER_VERSION = "gunicorn/%s" % __version__
|
|
||||||
NORMALIZE_SPACE = re.compile(r'(?:\r\n)?[ \t]+')
|
NORMALIZE_SPACE = re.compile(r'(?:\r\n)?[ \t]+')
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -28,7 +27,7 @@ def create(req, sock, client, server, cfg):
|
|||||||
"wsgi.multiprocess": (cfg.workers > 1),
|
"wsgi.multiprocess": (cfg.workers > 1),
|
||||||
"wsgi.run_once": False,
|
"wsgi.run_once": False,
|
||||||
"gunicorn.socket": sock,
|
"gunicorn.socket": sock,
|
||||||
"SERVER_SOFTWARE": SERVER_VERSION,
|
"SERVER_SOFTWARE": SERVER_SOFTWARE,
|
||||||
"REQUEST_METHOD": req.method,
|
"REQUEST_METHOD": req.method,
|
||||||
"QUERY_STRING": req.query,
|
"QUERY_STRING": req.query,
|
||||||
"RAW_URI": req.uri,
|
"RAW_URI": req.uri,
|
||||||
@ -112,7 +111,7 @@ class Response(object):
|
|||||||
def __init__(self, req, sock):
|
def __init__(self, req, sock):
|
||||||
self.req = req
|
self.req = req
|
||||||
self.sock = sock
|
self.sock = sock
|
||||||
self.version = SERVER_VERSION
|
self.version = SERVER_SOFTWARE
|
||||||
self.status = None
|
self.status = None
|
||||||
self.chunked = False
|
self.chunked = False
|
||||||
self.should_close = req.should_close()
|
self.should_close = req.should_close()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user