From: Kirill A. Korinsky Subject: Re: relayd: set User-Agent for HTTP healthchecks To: Rafael Sadowski Cc: Lloyd , tech@openbsd.org, Joel Carnat , Kirill Bychkov Date: Mon, 09 Mar 2026 12:05:04 +0100 On Fri, 27 Feb 2026 20:34:29 +0100, Rafael Sadowski wrote: > > 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. > I like it as well. But HTTP/1.1 makes Host header mandatory, which out of this discussion, but I think worth to pointed because we're near this code anyway. > 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); > -- wbr, Kirill