From 6f69e92bc9fc7bf698dbf0243e1496a7d675ab0c Mon Sep 17 00:00:00 2001 From: Simon Smith Date: Mon, 29 Jan 2024 21:11:45 +0000 Subject: [PATCH] set the user-agent to 'meshagent+source-commit-date' --- meshcore/agentcore.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meshcore/agentcore.c b/meshcore/agentcore.c index fe786ca1..f71fa776 100644 --- a/meshcore/agentcore.c +++ b/meshcore/agentcore.c @@ -4129,6 +4129,13 @@ void MeshServer_ConnectEx(MeshAgentHostContainer *agent) ILibAddHeaderLine(req, "Host", 4, ILibScratchPad, (int)sprintf_s(ILibScratchPad, sizeof(ILibScratchPad), "%s:%u", host, port)); } + // Set User-Agent for proxies to identify agents and versions + const char* FieldData = "MeshAgent "; + char combined[40]; + strcpy(combined, FieldData); + strcat(combined, SOURCE_COMMIT_DATE); + ILibAddHeaderLine(req, "User-Agent", 10, combined, (int)strnlen_s(combined, 50)); + free(path); if (useproxy != 0 || meshServer.sin6_family != AF_UNSPEC)