From 364171bfa65c29a841493a14a87e85df7597f6aa Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Mon, 16 Dec 2024 16:35:22 +0100 Subject: [PATCH] scheduler: Fix removing Server header from HTTP if requested Use `httpSetDefaultField()` in `cupsdAcceptClient()` to do the trick. Fixes #1111 --- CHANGES.md | 1 + scheduler/client.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 08e3ee803..9fba98299 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,6 +9,7 @@ Changes in CUPS v2.4.12 (YYYY-MM-DD) - Fixed a compressed file error handling bug (Issue #1070) - Fixed a bug in the make-and-model whitespace trimming code (Issue #1096) - Fixed a removal of IPP Everywhere permanent queue if installation failed (Issue #1102) +- Fixed `ServerToken None` in scheduler (Issue #1111) - Fixed the default User-Agent string. - Fixed a recursion issue in `ippReadIO`. diff --git a/scheduler/client.c b/scheduler/client.c index 233f9017d..e61f05005 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -330,6 +330,13 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */ con->serverport = httpAddrPort(&(lis->address)); } + /* + * Apply ServerHeader if any + */ + + if (ServerHeader) + httpSetDefaultField(con->http, HTTP_FIELD_SERVER, ServerHeader); + /* * Add the connection to the array of active clients... */ @@ -2146,9 +2153,6 @@ cupsdSendHeader( code = HTTP_STATUS_OK; } - if (ServerHeader) - httpSetField(con->http, HTTP_FIELD_SERVER, ServerHeader); - if (code == HTTP_STATUS_METHOD_NOT_ALLOWED) httpSetField(con->http, HTTP_FIELD_ALLOW, "GET, HEAD, OPTIONS, POST, PUT");