From 2f944c9bea6238ab3feee4f36352dbeaa8b15859 Mon Sep 17 00:00:00 2001 From: Benoit Chesneau Date: Fri, 10 Jan 2020 11:00:00 +0100 Subject: [PATCH 1/3] remove version from the Server header while we still want to know which server is running to ease operation, the version was giving too much information on the installation, so let's remove it. --- gunicorn/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gunicorn/__init__.py b/gunicorn/__init__.py index 467084a2..24f6e7ff 100644 --- a/gunicorn/__init__.py +++ b/gunicorn/__init__.py @@ -5,4 +5,4 @@ version_info = (20, 0, 4) __version__ = ".".join([str(v) for v in version_info]) -SERVER_SOFTWARE = "gunicorn/%s" % __version__ +SERVER_SOFTWARE = "gunicorn" From dcfd0f04e8bed3bbe5e44cf058c489298c22cb30 Mon Sep 17 00:00:00 2001 From: Benoit Chesneau Date: Fri, 10 Jan 2020 13:50:53 +0100 Subject: [PATCH 2/3] fix SERVER_SOFTWARE property WSGI spec requires the SERVER_SOFTWARE property containing the name and version. This change fix it and separate the version header from SERVER_SOFTWARE property. We expose the SERVER variable so custom installations can change it in one place without looking much when needed. --- gunicorn/__init__.py | 4 +++- gunicorn/http/wsgi.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gunicorn/__init__.py b/gunicorn/__init__.py index 24f6e7ff..6c208488 100644 --- a/gunicorn/__init__.py +++ b/gunicorn/__init__.py @@ -5,4 +5,6 @@ version_info = (20, 0, 4) __version__ = ".".join([str(v) for v in version_info]) -SERVER_SOFTWARE = "gunicorn" +SERVER = "gunicorn" +SERVER_SOFTWARE = "%s/%s" % (SERVER, __version__) + diff --git a/gunicorn/http/wsgi.py b/gunicorn/http/wsgi.py index 17360826..478677f4 100644 --- a/gunicorn/http/wsgi.py +++ b/gunicorn/http/wsgi.py @@ -11,7 +11,7 @@ import sys from gunicorn.http.message import HEADER_RE from gunicorn.http.errors import InvalidHeader, InvalidHeaderName -from gunicorn import SERVER_SOFTWARE +from gunicorn import SERVER_SOFTWARE, SERVER import gunicorn.util as util # Send files in at most 1GB blocks as some operating systems can have problems @@ -195,7 +195,7 @@ class Response(object): def __init__(self, req, sock, cfg): self.req = req self.sock = sock - self.version = SERVER_SOFTWARE + self.version = SERVER self.status = None self.chunked = False self.must_close = False From f74f926f3673a2cb97ae09be9b4d2af2eb2cc51b Mon Sep 17 00:00:00 2001 From: Benoit Chesneau Date: Fri, 10 Jan 2020 13:58:29 +0100 Subject: [PATCH 3/3] remove trailing new line --- gunicorn/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/gunicorn/__init__.py b/gunicorn/__init__.py index 6c208488..cc376951 100644 --- a/gunicorn/__init__.py +++ b/gunicorn/__init__.py @@ -7,4 +7,3 @@ version_info = (20, 0, 4) __version__ = ".".join([str(v) for v in version_info]) SERVER = "gunicorn" SERVER_SOFTWARE = "%s/%s" % (SERVER, __version__) -