diff --git a/webserv/handler/CgiHandler.cpp b/webserv/handler/CgiHandler.cpp index 1ea5465..104faf2 100644 --- a/webserv/handler/CgiHandler.cpp +++ b/webserv/handler/CgiHandler.cpp @@ -1,3 +1,4 @@ +#include "webserv/http/HttpConstants.hpp" #include // for Client #include #include // for CgiProcess @@ -342,7 +343,7 @@ void CgiHandler::handleTimeout() Log::info("Terminated CGI process with PID: " + std::to_string(pid_)); } - ErrorHandler::createErrorResponse(504, response_); + ErrorHandler::createErrorResponse(Http::StatusCode::GATEWAY_TIMEOUT, response_); // cancelTimer(); } diff --git a/webserv/handler/DeleteHandler.cpp b/webserv/handler/DeleteHandler.cpp index eee83c9..0a24419 100644 --- a/webserv/handler/DeleteHandler.cpp +++ b/webserv/handler/DeleteHandler.cpp @@ -73,5 +73,5 @@ void DeleteHandler::deleteDirectory(const std::string &path) void DeleteHandler::handleTimeout() { Log::debug("DeleteHandler: Request timed out"); - ErrorHandler::createErrorResponse(504, response_, request_.getUri().getConfig()); + ErrorHandler::createErrorResponse(Http::StatusCode::GATEWAY_TIMEOUT, response_, request_.getUri().getConfig()); } \ No newline at end of file diff --git a/webserv/handler/FileHandler.cpp b/webserv/handler/FileHandler.cpp index 11fa35e..61ff635 100644 --- a/webserv/handler/FileHandler.cpp +++ b/webserv/handler/FileHandler.cpp @@ -24,7 +24,7 @@ FileHandler::FileHandler(const HttpRequest &request, HttpResponse &response) void FileHandler::handleTimeout() { Log::warning("File handler timeout occurred for path: " + uri_.getFullPath()); - ErrorHandler::createErrorResponse(504, response_, config_); + ErrorHandler::createErrorResponse(Http::StatusCode::GATEWAY_TIMEOUT, response_, config_); } void FileHandler::handleFile(const std::string &filepath) const diff --git a/webserv/handler/RedirectHandler.cpp b/webserv/handler/RedirectHandler.cpp index 64ad9d3..e1acc58 100644 --- a/webserv/handler/RedirectHandler.cpp +++ b/webserv/handler/RedirectHandler.cpp @@ -34,6 +34,6 @@ void RedirectHandler::handleTimeout() { Log::warning("Redirect handler timeout occurred for path: " + request_.getUri().getFullPath()); - ErrorHandler::createErrorResponse(504, response_, request_.getUri().getConfig()); + ErrorHandler::createErrorResponse(Http::StatusCode::GATEWAY_TIMEOUT, response_, request_.getUri().getConfig()); } diff --git a/webserv/http/HttpConstants.hpp b/webserv/http/HttpConstants.hpp index 16ce1a8..83da724 100644 --- a/webserv/http/HttpConstants.hpp +++ b/webserv/http/HttpConstants.hpp @@ -53,6 +53,7 @@ constexpr uint16_t INTERNAL_SERVER_ERROR = 500; constexpr uint16_t NOT_IMPLEMENTED = 501; constexpr uint16_t BAD_GATEWAY = 502; constexpr uint16_t SERVICE_UNAVAILABLE = 503; +constexpr uint16_t GATEWAY_TIMEOUT = 504; } // namespace StatusCode struct StatusCodeInfo