trying to setup tester weird stufffff

This commit is contained in:
whaffman 2025-10-19 14:22:00 +02:00
parent 0c081bbb2c
commit 0d57ce4f27
12 changed files with 39 additions and 3 deletions

BIN
cgi_tester Normal file

Binary file not shown.

View File

@ -124,3 +124,38 @@ server {
cgi_enabled yes;
cgi_ext .php /usr/bin/php-cgi;
}
server {
listen 8083;
host 127.0.0.1;
server_name localhost;
root ./htdocs/YoupiBanane/;
index index.html index2.htm;
location / {
root ./htdocs/YoupiBanane/;
index index.html;
allowed_methods GET;
}
location /put_test {
root ./htdocs/YoupiBanane/;
allowed_methods PUT;
}
location /post_body {
root ./htdocs/YoupiBanane/;
client_max_body_size 100;
allowed_methods POST;
}
location /directory {
root ./htdocs/YoupiBanane/;
index youpi.bad_extension
allowed_methods GET;
}
cgi_enabled yes;
cgi_ext .bla ./ubuntu_cgi_tester
}

View File

View File

View File

BIN
tester Normal file

Binary file not shown.

BIN
ubuntu_cgi_tester Executable file

Binary file not shown.

BIN
ubuntu_tester Executable file

Binary file not shown.

View File

@ -37,7 +37,8 @@ ConfigValidator::ConfigValidator(const GlobalConfig *config) : engine_(std::make
/*Location Directive Rules*/
engine_->addLocationRule("allowed_methods",
std::make_unique<AllowedValuesRule>(std::vector<std::string>{"GET", "POST", "DELETE"}));
std::make_unique<AllowedValuesRule>(std::vector<std::string>{"GET", "POST", "DELETE", "PUT"},
true));
engine_->addLocationRule("root", std::make_unique<FolderExistsRule>(true));
engine_->addLocationRule("cgi_ext", std::make_unique<CgiExtValidationRule>(false));

View File

@ -17,7 +17,7 @@ CgiExtValidationRule::CgiExtValidationRule(bool requiresValue)
bool isAllowedCGIExtension(const std::string &extension)
{
static const std::vector<std::string> allowedExtensions = {".php", ".py"};
static const std::vector<std::string> allowedExtensions = {".php", ".py", ".bla"};
return std::ranges::any_of(allowedExtensions, [&extension](const auto &it) { return extension == it; });
}