summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/waitress/task.py3
-rw-r--r--src/waitress/utilities.py5
2 files changed, 5 insertions, 3 deletions
diff --git a/src/waitress/task.py b/src/waitress/task.py
index 574532f..956c0c0 100644
--- a/src/waitress/task.py
+++ b/src/waitress/task.py
@@ -345,8 +345,9 @@ class ErrorTask(Task):
complete = True
def execute(self):
+ ident = self.channel.server.adj.ident
e = self.request.error
- status, headers, body = e.to_response()
+ status, headers, body = e.to_response(ident)
self.status = status
self.response_headers.extend(headers)
# We need to explicitly tell the remote client we are closing the
diff --git a/src/waitress/utilities.py b/src/waitress/utilities.py
index 164752f..3c39787 100644
--- a/src/waitress/utilities.py
+++ b/src/waitress/utilities.py
@@ -258,10 +258,11 @@ class Error:
def __init__(self, body):
self.body = body
- def to_response(self):
+ def to_response(self, ident=None):
status = f"{self.code} {self.reason}"
body = f"{self.reason}\r\n\r\n{self.body}"
- tag = "\r\n\r\n(generated by waitress)"
+ ident = ident if ident else "server"
+ tag = f"\r\n\r\n(generated by {ident})"
body = (body + tag).encode("utf-8")
headers = [("Content-Type", "text/plain; charset=utf-8")]