fix: ensure location blocks are not allowed in global context
This commit is contained in:
parent
7072f71e00
commit
cd64f98b31
@ -1,5 +1,4 @@
|
||||
#include <webserv/config/GlobalConfig.hpp>
|
||||
|
||||
#include <webserv/log/Log.hpp> // for Log
|
||||
#include <webserv/utils/utils.hpp> // for findCorrespondingClosingBrace
|
||||
|
||||
@ -50,6 +49,11 @@ void GlobalConfig::parseBlock(const std::string &block)
|
||||
servers_.emplace_back(std::make_unique<ServerConfig>(serverBlock, this));
|
||||
pos = closeBrace + 1;
|
||||
}
|
||||
|
||||
if (block.find("location", 0) != std::string::npos)
|
||||
{
|
||||
throw std::runtime_error("Location blocks are not allowed in the global context.");
|
||||
}
|
||||
|
||||
parseDirectives(directives);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user