diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b2c48b..a62fbad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,7 +106,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") add_definitions(-DDEBUG) elseif(CMAKE_BUILD_TYPE STREQUAL "Release") message(STATUS "Release build: adding optimization flags") - add_compile_options(-O3) + add_compile_options(-O2 -g -Wall -Wextra -Werror) add_definitions(-DNDEBUG) elseif(CMAKE_BUILD_TYPE STREQUAL "ASAN") message(STATUS "AddressSanitizer build: adding sanitizer flags") diff --git a/config/default.conf b/config/default.conf index 388276a..34d4c35 100644 --- a/config/default.conf +++ b/config/default.conf @@ -42,8 +42,8 @@ server { allowed_methods GET; } - cgi_enabled yes; - cgi_ext .php /usr/bin/php-cgi; + # cgi_enabled yes; + # cgi_ext .php /usr/bin/php-cgi; } server { @@ -85,6 +85,6 @@ server { # allowed_methods GET; # } - cgi_enabled yes; - cgi_ext .php /usr/bin/php-cgi; + # cgi_enabled yes; + # cgi_ext .php /usr/bin/php-cgi; } \ No newline at end of file diff --git a/webserv/client/Client.cpp b/webserv/client/Client.cpp index 563fc87..281d993 100644 --- a/webserv/client/Client.cpp +++ b/webserv/client/Client.cpp @@ -15,8 +15,8 @@ #include // for ssize_t Client::Client(std::unique_ptr socket, Server &server) - : client_socket_(std::move(socket)), server_(std::ref(server)), httpRequest_(std::make_unique(this)), - httpResponse_(std::make_unique()) + : httpRequest_(std::make_unique(this)), httpResponse_(std::make_unique()), client_socket_(std::move(socket)), + server_(std::ref(server)) { Log::trace(LOCATION); Log::info("New client connected, fd: " + std::to_string(client_socket_->getFd())); @@ -98,6 +98,7 @@ std::vector Client::getResponse() const Log::trace(LOCATION); const Router &router = server_.getRouter(); + static_cast(router); // Suppress unused variable warning auto response = Router::handleRequest(*httpRequest_); return response->toBytes(); } \ No newline at end of file diff --git a/webserv/client/Client.hpp b/webserv/client/Client.hpp index 05d5228..6a8b8cc 100644 --- a/webserv/client/Client.hpp +++ b/webserv/client/Client.hpp @@ -50,5 +50,5 @@ class Client std::unique_ptr httpResponse_ = nullptr; std::unique_ptr client_socket_; Server &server_; - mutable const ServerConfig *server_config_ = nullptr; + // mutable const ServerConfig *server_config_ = nullptr; }; \ No newline at end of file diff --git a/webserv/config/AConfig.cpp b/webserv/config/AConfig.cpp index fbdf9f8..d29e219 100644 --- a/webserv/config/AConfig.cpp +++ b/webserv/config/AConfig.cpp @@ -84,7 +84,7 @@ void AConfig::parseDirectives(const std::string &declarations) std::string AConfig::getErrorPage(int statusCode) const { // TODO - const ADirective *directive = getDirective("error_page"); + Log::trace(LOCATION); for (const auto &directive : directives_) { if (directive->getName() == "error_page") diff --git a/webserv/config/GlobalConfig.hpp b/webserv/config/GlobalConfig.hpp index dd6fdfe..530130e 100644 --- a/webserv/config/GlobalConfig.hpp +++ b/webserv/config/GlobalConfig.hpp @@ -26,7 +26,7 @@ class GlobalConfig : public AConfig [[nodiscard]] std::vector getServerConfigs() const; private: - AConfig *parent_ = nullptr; + // AConfig *parent_; std::vector> servers_; void parseBlock(const std::string &block) override; diff --git a/webserv/config/ServerConfig.hpp b/webserv/config/ServerConfig.hpp index 19423eb..2f5f1d2 100644 --- a/webserv/config/ServerConfig.hpp +++ b/webserv/config/ServerConfig.hpp @@ -29,7 +29,7 @@ class ServerConfig : public AConfig private: std::map> locations_; - AConfig *parent_ = nullptr; + // AConfig *parent_; void parseBlock(const std::string &block) override; }; \ No newline at end of file diff --git a/webserv/config/validation/ConfigValidator.cpp b/webserv/config/validation/ConfigValidator.cpp index 67b4c3e..f18027e 100644 --- a/webserv/config/validation/ConfigValidator.cpp +++ b/webserv/config/validation/ConfigValidator.cpp @@ -27,13 +27,13 @@ ConfigValidator::ConfigValidator(const GlobalConfig *config) : engine_(std::make /*Server Directive Rules*/ engine_->addServerRule("listen", std::make_unique()); engine_->addServerRule("host", std::make_unique()); - engine_->addServerRule("root", std::make_unique(true)); + engine_->addServerRule("root", std::make_unique(false)); /*Location Directive Rules*/ engine_->addLocationRule("allowed_methods", std::make_unique(std::vector{"GET", "POST", "DELETE"})); engine_->addLocationRule("root", std::make_unique(true)); - engine_->addLocationRule("cgi_ext", std::make_unique(true)); + engine_->addLocationRule("cgi_ext", std::make_unique(false)); engine_->validate(); } diff --git a/webserv/config/validation/directive_rules/RequiredDirectiveRule.cpp b/webserv/config/validation/directive_rules/RequiredDirectiveRule.cpp index 460c939..1a8920c 100644 --- a/webserv/config/validation/directive_rules/RequiredDirectiveRule.cpp +++ b/webserv/config/validation/directive_rules/RequiredDirectiveRule.cpp @@ -11,5 +11,7 @@ RequiredDirectiveRule::RequiredDirectiveRule() ValidationResult RequiredDirectiveRule::validateValue(const AConfig *config, const std::string &directiveName) const { + static_cast(config); // Suppress unused parameter warning + static_cast(directiveName); return ValidationResult::success(); } \ No newline at end of file diff --git a/webserv/handler/FileHandler.cpp b/webserv/handler/FileHandler.cpp index fe17c4d..e590a7e 100644 --- a/webserv/handler/FileHandler.cpp +++ b/webserv/handler/FileHandler.cpp @@ -85,6 +85,7 @@ std::unique_ptr FileHandler::getResponse() const FileHandler::ResourceType FileHandler::getResourceType(const std::string &path) const { + static_cast(path); Log::trace(LOCATION); if (uriParser_.isFile()) diff --git a/webserv/router/Router.cpp b/webserv/router/Router.cpp index d70515c..7d3b9de 100644 --- a/webserv/router/Router.cpp +++ b/webserv/router/Router.cpp @@ -45,6 +45,7 @@ std::unique_ptr Router::handleRequest(const HttpRequest &request) URIParser uriParser{request.getTarget(), *config}; const std::string &target = request.getTarget(); + static_cast(target); // Suppress unused variable warning const std::string &method = request.getMethod(); const LocationConfig *location = uriParser.getLocation();