Index | Thread | Search

From:
Rafael Sadowski <rafael@sizeofvoid.org>
Subject:
Re: relayd: set User-Agent for HTTP healthchecks
To:
Lloyd <ng2d68@proton.me>
Cc:
tech@openbsd.org, Joel Carnat <joel@carnat.net>, Kirill Bychkov <kirby@linklevel.net>
Date:
Fri, 27 Feb 2026 20:34:29 +0100

Download raw body.

Thread
On Fri Feb 27, 2026 at 06:44:20PM +0000, Lloyd wrote:
> I checked and indeed RELAYD_SERVERNAME is defined in relayd.h.
> 

I like the idea with RELAYD_SERVERNAME.

diff --git a/usr.sbin/relayd/parse.y b/usr.sbin/relayd/parse.y
index fcdfb8e92e3..2a9bf181b11 100644
--- a/usr.sbin/relayd/parse.y
+++ b/usr.sbin/relayd/parse.y
@@ -921,8 +921,8 @@ tablecheck	: ICMP			{ table->conf.check = CHECK_ICMP; }
 				YYERROR;
 			}
 			if (asprintf(&table->sendbuf,
-			    "HEAD %s HTTP/1.%c\r\n%s\r\n",
-			    $2, strlen($3) ? '1' : '0', $3) == -1)
+			    "HEAD %s HTTP/1.%c\r\nUser-Agent: %s\r\n%s\r\n",
+			    $2, strlen($3) ? '1' : '0', RELAYD_SERVERNAME, $3) == -1)
 				fatal("asprintf");
 			free($2);
 			free($3);
@@ -936,8 +936,8 @@ tablecheck	: ICMP			{ table->conf.check = CHECK_ICMP; }
 			}
 			table->conf.check = CHECK_HTTP_DIGEST;
 			if (asprintf(&table->sendbuf,
-			    "GET %s HTTP/1.%c\r\n%s\r\n",
-			    $2, strlen($3) ? '1' : '0', $3) == -1)
+			    "GET %s HTTP/1.%c\r\nUser-Agent: %s\r\n%s\r\n",
+			    $2, strlen($3) ? '1' : '0', RELAYD_SERVERNAME, $3) == -1)
 				fatal("asprintf");
 			free($2);
 			free($3);