You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2023/05/22 15:06:30 UTC

[couchdb] 01/01: optionally suppress version info in server response header

This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch server-header-versions
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 633938642cce3b6d3a0af79c3d97e4cee1ec1e11
Author: Robert Newson <rn...@apache.org>
AuthorDate: Mon May 22 16:06:05 2023 +0100

    optionally suppress version info in server response header
---
 src/couch/src/couch_httpd.erl | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/couch/src/couch_httpd.erl b/src/couch/src/couch_httpd.erl
index 91c7f91ee..9280a0959 100644
--- a/src/couch/src/couch_httpd.erl
+++ b/src/couch/src/couch_httpd.erl
@@ -1202,11 +1202,16 @@ negotiate_content_type(_Req) ->
     end.
 
 server_header() ->
-    [
-        {"Server",
-            "CouchDB/" ++ couch_server:get_version() ++
-                " (Erlang OTP/" ++ erlang:system_info(otp_release) ++ ")"}
-    ].
+    case config:get_boolean("httpd", "send_server_header_versions", true) of
+        false ->
+            [{"Server", "CouchDB"}];
+        true ->
+            [
+                {"Server",
+                    "CouchDB/" ++ couch_server:get_version() ++
+                        " (Erlang OTP/" ++ erlang:system_info(otp_release) ++ ")"}
+            ]
+    end.
 
 -record(mp, {boundary, buffer, data_fun, callback}).