From bd45e75d994502097185cc5970885675c9e79c86 Mon Sep 17 00:00:00 2001 From: Michael de Hoog Date: Sat, 22 Aug 2020 18:51:43 -0700 Subject: [PATCH] Append a "host" attribute to error responses --- src/mongo/db/service_entry_point_common.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp index 81ab2961805dc..9b5cfd26ffdcc 100644 --- a/src/mongo/db/service_entry_point_common.cpp +++ b/src/mongo/db/service_entry_point_common.cpp @@ -99,6 +99,7 @@ #include "mongo/util/duration.h" #include "mongo/util/fail_point.h" #include "mongo/util/scopeguard.h" +#include "mongo/util/net/socket_utils.h" #include @@ -214,6 +215,7 @@ void generateErrorResponse(OperationContext* opCtx, // so we need to reset it to a clean state just to be sure. replyBuilder->reset(); replyBuilder->setCommandReply(exception.toStatus(), extraFields); + replyBuilder->getBodyBuilder().append("host", getHostNameCachedAndPort()); replyBuilder->getBodyBuilder().appendElements(replyMetadata); }