From 6f62f72a1b39ecf457f05fc9f040e3c3c4fde918 Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Mon, 29 Apr 2024 08:05:41 -0700 Subject: [PATCH] Add overrides option to set User-Agent header. --- Rocksolid_Light/rocksolid/lib/post.inc.php | 8 +++++++- Rocksolid_Light/rslight/overrides.inc.php.dist | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Rocksolid_Light/rocksolid/lib/post.inc.php b/Rocksolid_Light/rocksolid/lib/post.inc.php index 2426ef1..9ab85a3 100644 --- a/Rocksolid_Light/rocksolid/lib/post.inc.php +++ b/Rocksolid_Light/rocksolid/lib/post.inc.php @@ -532,7 +532,13 @@ function message_post($subject, $from, $newsgroups, $ref, $body, $encryptthis = fputs($ns, "Content-Type: text/plain; charset=" . $www_charset . "; format=flowed\r\n"); fputs($ns, "Content-Transfer-Encoding: 8bit\r\n"); } - fputs($ns, "User-Agent: Rocksolid Light\r\n"); + if (isset($OVERRIDES['user_agent'])) { + if ($OVERRIDES['user_agent'] != '') { + fputs($ns, "User-Agent: " . $OVERRIDES['user_agent'] . "\r\n"); + } + } else { + fputs($ns, "User-Agent: Rocksolid Light\r\n"); + } if ($send_poster_host) @fputs($ns, 'X-HTTP-Posting-Host: ' . gethostbyaddr(getenv("REMOTE_ADDR")) . "\r\n"); if (($ref != false) && (count($ref) > 0)) { diff --git a/Rocksolid_Light/rslight/overrides.inc.php.dist b/Rocksolid_Light/rslight/overrides.inc.php.dist index 3173418..6d0d154 100644 --- a/Rocksolid_Light/rslight/overrides.inc.php.dist +++ b/Rocksolid_Light/rslight/overrides.inc.php.dist @@ -58,6 +58,10 @@ return [ // If unset, default is 'articles' 'overboard_default_view' => 'articles', + // Set User-Agent: string (default = 'Rocksolid Light') + // Set to '' for no User-Agent: header + 'user_agent' => 'Rocksolid Light', + // Just leave this here to avoid comma errors 'comma' => true ];