From fe3b28fbfe270e54ad266a5a455f727e0e970233 Mon Sep 17 00:00:00 2001 From: whaffman Date: Fri, 31 Oct 2025 15:09:50 +0100 Subject: [PATCH] fix: enforce single semicolon in directives and handle multiple semicolons --- webserv/config/AConfig.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/webserv/config/AConfig.cpp b/webserv/config/AConfig.cpp index 623f3b3..1cf4d42 100644 --- a/webserv/config/AConfig.cpp +++ b/webserv/config/AConfig.cpp @@ -22,8 +22,12 @@ void AConfig::addDirective(const std::string &line) ++semicolon_count; } } + if (semicolon_count > 1) + { + throw std::runtime_error("Directive contains multiple semicolons: " + line); + } - if (semicolon_count != 1 || line.back() != ';') + if (line.back() != ';') { throw std::runtime_error("Directive must end with a single semicolon"); }