refactor: change magic 504 to constant
This commit is contained in:
parent
0138883af6
commit
05b8ebf61b
@ -1,3 +1,4 @@
|
||||
#include "webserv/http/HttpConstants.hpp"
|
||||
#include <webserv/client/Client.hpp> // for Client
|
||||
#include <webserv/handler/CgiHandler.hpp>
|
||||
#include <webserv/handler/CgiProcess.hpp> // 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();
|
||||
}
|
||||
|
||||
|
||||
@ -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());
|
||||
}
|
||||
@ -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
|
||||
|
||||
@ -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());
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user