Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
Re: relayd: set User-Agent for HTTP healthchecks
To:
Rafael Sadowski <rafael@sizeofvoid.org>
Cc:
Lloyd <ng2d68@proton.me>, tech@openbsd.org, Joel Carnat <joel@carnat.net>, Kirill Bychkov <kirby@linklevel.net>
Date:
Mon, 09 Mar 2026 12:05:04 +0100

Download raw body.

Thread
On Fri, 27 Feb 2026 20:34:29 +0100,
Rafael Sadowski <rafael@sizeofvoid.org> 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