Frontend: Don't allow viewing private channel logs without access

This commit is contained in:
2023-09-12 20:21:15 +02:00
parent c296f53678
commit f1724d2f23
2 changed files with 56 additions and 5 deletions

View File

@@ -297,6 +297,18 @@ sub sendBadRequest {
$aClient->send($response);
}
sub sendUnauthorized {
my $aClient = $_[0];
my $aMessage = $_[1];
my $content = "<h1>401 Unauthorized</h1><h6>irclogger_web</h6>Error: $aMessage";
my $response = getBaseResponse(401, "Unauthorized");
$response.="Content-Type: text/html, charset=utf-8\r\n";
$response.="Content-Length: ".length($content)."\r\n\r\n";
$response.=$content;
$aClient->send($response);
}
sub sendForbidden {
my $aClient = $_[0];
my $aMessage = $_[1];
@@ -429,7 +441,7 @@ sub sendResponse {
my $aRequest = $_[1];
my $aConnection = $_[2];
if($aRequest->{"version"} ne "HTTP/1.1") {
if($aRequest->{"version"} ne "HTTP/1.0" && $aRequest->{"version"} ne "HTTP/1.1") {
sendNotImplemented($aClient);
return;
}