iwyu
This commit is contained in:
parent
5e9243b064
commit
d98fb98c52
@ -1,11 +1,7 @@
|
|||||||
[
|
[
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# WEBSERV PROJECT IWYU MAPPINGS
|
# STANDARD LIBRARY PRIVATE IMPLEMENTATION MAPPINGS
|
||||||
# Based on preferences: Forward declarations in headers, central common header,
|
|
||||||
# umbrella headers for modules, strict standard library includes, stdexcept
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
# Standard C++ library private implementation mappings
|
|
||||||
{ include: ["<bits/std_abs.h>", "private", "<cstdlib>", "public"] },
|
{ include: ["<bits/std_abs.h>", "private", "<cstdlib>", "public"] },
|
||||||
{ include: ["<bits/stdint-intn.h>", "private", "<cstdint>", "public"] },
|
{ include: ["<bits/stdint-intn.h>", "private", "<cstdint>", "public"] },
|
||||||
{ include: ["<bits/stdint-uintn.h>", "private", "<cstdint>", "public"] },
|
{ include: ["<bits/stdint-uintn.h>", "private", "<cstdint>", "public"] },
|
||||||
@ -14,23 +10,17 @@
|
|||||||
{ include: ["<bits/exception.h>", "private", "<exception>", "public"] },
|
{ include: ["<bits/exception.h>", "private", "<exception>", "public"] },
|
||||||
{ include: ["<bits/std_function.h>", "private", "<functional>", "public"] },
|
{ include: ["<bits/std_function.h>", "private", "<functional>", "public"] },
|
||||||
{ include: ["<bits/stringfwd.h>", "private", "<string>", "public"] },
|
{ include: ["<bits/stringfwd.h>", "private", "<string>", "public"] },
|
||||||
|
{ include: ["<bits/basic_string.h>", "private", "<string>", "public"] },
|
||||||
|
{ include: ["<bits/move.h>", "private", "<utility>", "public"] },
|
||||||
|
{ include: ["<bits/stl_pair.h>", "private", "<utility>", "public"] },
|
||||||
|
{ include: ["<bits/stl_vector.h>", "private", "<vector>", "public"] },
|
||||||
|
{ include: ["<bits/stl_map.h>", "private", "<map>", "public"] },
|
||||||
|
{ include: ["<bits/unique_ptr.h>", "private", "<memory>", "public"] },
|
||||||
|
{ include: ["<bits/shared_ptr.h>", "private", "<memory>", "public"] },
|
||||||
|
|
||||||
# Standard library strict mappings (preference 5C - very strict)
|
# ============================================================================
|
||||||
{ include: ["<iostream>", "public", "<iostream>", "public"] },
|
# SYSTEM HEADERS
|
||||||
{ symbol: ["std::cout", "private", "<iostream>", "public"] },
|
# ============================================================================
|
||||||
{ symbol: ["std::cerr", "private", "<iostream>", "public"] },
|
|
||||||
{ symbol: ["std::cin", "private", "<iostream>", "public"] },
|
|
||||||
{ symbol: ["std::endl", "private", "<iostream>", "public"] },
|
|
||||||
{ symbol: ["std::vector", "private", "<vector>", "public"] },
|
|
||||||
{ symbol: ["std::string", "private", "<string>", "public"] },
|
|
||||||
{ symbol: ["std::map", "private", "<map>", "public"] },
|
|
||||||
{ symbol: ["std::unordered_map", "private", "<unordered_map>", "public"] },
|
|
||||||
{ symbol: ["std::unique_ptr", "private", "<memory>", "public"] },
|
|
||||||
{ symbol: ["std::shared_ptr", "private", "<memory>", "public"] },
|
|
||||||
{ symbol: ["std::make_unique", "private", "<memory>", "public"] },
|
|
||||||
{ symbol: ["std::make_shared", "private", "<memory>", "public"] },
|
|
||||||
|
|
||||||
# System headers for socket programming
|
|
||||||
{ include: ["<sys/socket.h>", "public", "<sys/socket.h>", "public"] },
|
{ include: ["<sys/socket.h>", "public", "<sys/socket.h>", "public"] },
|
||||||
{ include: ["<netinet/in.h>", "public", "<netinet/in.h>", "public"] },
|
{ include: ["<netinet/in.h>", "public", "<netinet/in.h>", "public"] },
|
||||||
{ include: ["<arpa/inet.h>", "public", "<arpa/inet.h>", "public"] },
|
{ include: ["<arpa/inet.h>", "public", "<arpa/inet.h>", "public"] },
|
||||||
@ -38,17 +28,9 @@
|
|||||||
{ include: ["<fcntl.h>", "public", "<fcntl.h>", "public"] },
|
{ include: ["<fcntl.h>", "public", "<fcntl.h>", "public"] },
|
||||||
{ include: ["<unistd.h>", "public", "<unistd.h>", "public"] },
|
{ include: ["<unistd.h>", "public", "<unistd.h>", "public"] },
|
||||||
|
|
||||||
# Error handling (preference 6A - stdexcept)
|
|
||||||
{ symbol: ["std::runtime_error", "private", "<stdexcept>", "public"] },
|
|
||||||
{ symbol: ["std::logic_error", "private", "<stdexcept>", "public"] },
|
|
||||||
{ symbol: ["std::invalid_argument", "private", "<stdexcept>", "public"] },
|
|
||||||
{ symbol: ["std::out_of_range", "private", "<stdexcept>", "public"] },
|
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# PROJECT HEADER MAPPINGS - Standardized on <> angle brackets
|
# PROJECT HEADERS - Normalize to angle brackets
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
# Convert quoted includes to angle brackets for consistency
|
|
||||||
{ include: ["\"webserv/log/Log.hpp\"", "public", "<webserv/log/Log.hpp>", "public"] },
|
{ include: ["\"webserv/log/Log.hpp\"", "public", "<webserv/log/Log.hpp>", "public"] },
|
||||||
{ include: ["\"webserv/log/Channel.hpp\"", "public", "<webserv/log/Channel.hpp>", "public"] },
|
{ include: ["\"webserv/log/Channel.hpp\"", "public", "<webserv/log/Channel.hpp>", "public"] },
|
||||||
{ include: ["\"webserv/log/StdoutChannel.hpp\"", "public", "<webserv/log/StdoutChannel.hpp>", "public"] },
|
{ include: ["\"webserv/log/StdoutChannel.hpp\"", "public", "<webserv/log/StdoutChannel.hpp>", "public"] },
|
||||||
@ -62,31 +44,27 @@
|
|||||||
{ include: ["\"webserv/config/ConfigManager.hpp\"", "public", "<webserv/config/ConfigManager.hpp>", "public"] },
|
{ include: ["\"webserv/config/ConfigManager.hpp\"", "public", "<webserv/config/ConfigManager.hpp>", "public"] },
|
||||||
{ include: ["\"webserv/config/ServerConfig.hpp\"", "public", "<webserv/config/ServerConfig.hpp>", "public"] },
|
{ include: ["\"webserv/config/ServerConfig.hpp\"", "public", "<webserv/config/ServerConfig.hpp>", "public"] },
|
||||||
{ include: ["\"webserv/config/LocationConfig.hpp\"", "public", "<webserv/config/LocationConfig.hpp>", "public"] },
|
{ include: ["\"webserv/config/LocationConfig.hpp\"", "public", "<webserv/config/LocationConfig.hpp>", "public"] },
|
||||||
{ include: ["\i"webserv/utils/utls.hpp\"", "public", "<webserv/utils/utils.hpp>", "public"] },
|
{ include: ["\"webserv/config/AConfig.hpp\"", "public", "<webserv/config/AConfig.hpp>", "public"] },
|
||||||
|
{ include: ["\"webserv/config/GlobalConfig.hpp\"", "public", "<webserv/config/GlobalConfig.hpp>", "public"] },
|
||||||
|
|
||||||
|
{ include: ["\"webserv/utils/utils.hpp\"", "public", "<webserv/utils/utils.hpp>", "public"] },
|
||||||
|
{ include: ["\"webserv/utils/FileUtils.hpp\"", "public", "<webserv/utils/FileUtils.hpp>", "public"] },
|
||||||
|
|
||||||
{ include: ["\"webserv/server/Server.hpp\"", "public", "<webserv/server/Server.hpp>", "public"] },
|
{ include: ["\"webserv/server/Server.hpp\"", "public", "<webserv/server/Server.hpp>", "public"] },
|
||||||
{ include: ["\"webserv/client/Client.hpp\"", "public", "<webserv/client/Client.hpp>", "public"] },
|
{ include: ["\"webserv/client/Client.hpp\"", "public", "<webserv/client/Client.hpp>", "public"] },
|
||||||
{ include: ["\"webserv/socket/Socket.hpp\"", "public", "<webserv/socket/Socket.hpp>", "public"] },
|
{ include: ["\"webserv/socket/ASocket.hpp\"", "public", "<webserv/socket/ASocket.hpp>", "public"] },
|
||||||
|
{ include: ["\"webserv/socket/ClientSocket.hpp\"", "public", "<webserv/socket/ClientSocket.hpp>", "public"] },
|
||||||
|
{ include: ["\"webserv/socket/ServerSocket.hpp\"", "public", "<webserv/socket/ServerSocket.hpp>", "public"] },
|
||||||
|
{ include: ["\"webserv/socket/CgiSocket.hpp\"", "public", "<webserv/socket/CgiSocket.hpp>", "public"] },
|
||||||
{ include: ["\"webserv/router/Router.hpp\"", "public", "<webserv/router/Router.hpp>", "public"] },
|
{ include: ["\"webserv/router/Router.hpp\"", "public", "<webserv/router/Router.hpp>", "public"] },
|
||||||
|
|
||||||
|
{ include: ["\"webserv/handler/AHandler.hpp\"", "public", "<webserv/handler/AHandler.hpp>", "public"] },
|
||||||
{ include: ["\"webserv/handler/CgiHandler.hpp\"", "public", "<webserv/handler/CgiHandler.hpp>", "public"] },
|
{ include: ["\"webserv/handler/CgiHandler.hpp\"", "public", "<webserv/handler/CgiHandler.hpp>", "public"] },
|
||||||
{ include: ["\"webserv/handler/FileHandler.hpp\"", "public", "<webserv/handler/FileHandler.hpp>", "public"] },
|
{ include: ["\"webserv/handler/FileHandler.hpp\"", "public", "<webserv/handler/FileHandler.hpp>", "public"] },
|
||||||
{ include: ["\"webserv/handler/ErrorHandler.hpp\"", "public", "<webserv/handler/ErrorHandler.hpp>", "public"] },
|
{ include: ["\"webserv/handler/ErrorHandler.hpp\"", "public", "<webserv/handler/ErrorHandler.hpp>", "public"] },
|
||||||
|
{ include: ["\"webserv/handler/URI.hpp\"", "public", "<webserv/handler/URI.hpp>", "public"] },
|
||||||
# ============================================================================
|
{ include: ["\"webserv/handler/CgiProcess.hpp\"", "public", "<webserv/handler/CgiProcess.hpp>", "public"] },
|
||||||
# FORWARD DECLARATION PREFERENCES
|
{ include: ["\"webserv/handler/CgiEnvironment.hpp\"", "public", "<webserv/handler/CgiEnvironment.hpp>", "public"] },
|
||||||
# ============================================================================
|
# CgiHandler needs CgiProcess for unique_ptr deletion
|
||||||
|
{ include: ["<webserv/handler/CgiHandler.hpp>", "public", "<webserv/handler/CgiProcess.hpp>", "public"] }
|
||||||
# Suggest forward declarations instead of full includes in headers where possible
|
|
||||||
{ symbol: ["Client", "private", "<webserv/client/Client.hpp>", "public"] },
|
|
||||||
{ symbol: ["Server", "private", "<webserv/server/Server.hpp>", "public"] },
|
|
||||||
{ symbol: ["HttpRequest", "private", "<webserv/http/HttpRequest.hpp>", "public"] },
|
|
||||||
{ symbol: ["HttpResponse", "private", "<webserv/http/HttpResponse.hpp>", "public"] },
|
|
||||||
{ symbol: ["HttpHeaders", "private", "<webserv/http/HttpHeaders.hpp>", "public"] },
|
|
||||||
{ symbol: ["ServerConfig", "private", "<webserv/config/ServerConfig.hpp>", "public"] },
|
|
||||||
{ symbol: ["ConfigManager", "private", "<webserv/config/ConfigManager.hpp>", "public"] },
|
|
||||||
{ symbol: ["LocationConfig", "private", "<webserv/config/LocationConfig.hpp>", "public"] },
|
|
||||||
{ symbol: ["Socket", "private", "<webserv/socket/Socket.hpp>", "public"] },
|
|
||||||
{ symbol: ["Router", "private", "<webserv/router/Router.hpp>", "public"] },
|
|
||||||
{ symbol: ["Channel", "private", "<webserv/log/Channel.hpp>", "public"] }
|
|
||||||
]
|
]
|
||||||
@ -1,25 +1,27 @@
|
|||||||
#include "webserv/handler/CgiHandler.hpp"
|
|
||||||
#include "webserv/handler/ErrorHandler.hpp"
|
|
||||||
#include "webserv/socket/ASocket.hpp"
|
|
||||||
#include "webserv/socket/CgiSocket.hpp"
|
|
||||||
|
|
||||||
#include <webserv/client/Client.hpp>
|
#include <webserv/client/Client.hpp>
|
||||||
#include <webserv/http/HttpHeaders.hpp> // for HttpHeaders
|
|
||||||
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
|
||||||
#include <webserv/router/Router.hpp> // for Router
|
|
||||||
#include <webserv/server/Server.hpp> // for Server
|
|
||||||
#include <webserv/socket/ClientSocket.hpp> // for Socket
|
|
||||||
|
|
||||||
#include <cstdint> // for uint8_t
|
#include <webserv/handler/CgiHandler.hpp> // for CgiHandler
|
||||||
#include <exception>
|
#include <webserv/handler/ErrorHandler.hpp> // for ErrorHandler
|
||||||
#include <functional> // for ref, reference_wrapper
|
#include <webserv/http/HttpHeaders.hpp> // for HttpHeaders
|
||||||
|
#include <webserv/http/HttpRequest.hpp> // for HttpRequest
|
||||||
|
#include <webserv/http/HttpResponse.hpp> // for HttpResponse
|
||||||
|
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
||||||
|
#include <webserv/router/Router.hpp> // for Router
|
||||||
|
#include <webserv/server/Server.hpp> // for Server
|
||||||
|
#include <webserv/socket/ASocket.hpp> // for ASocket
|
||||||
|
#include <webserv/socket/ClientSocket.hpp> // for ClientSocket
|
||||||
|
|
||||||
|
#include <cstdint> // for uint8_t
|
||||||
|
#include <functional> // for function, ref, reference_wrapper
|
||||||
#include <map> // for map
|
#include <map> // for map
|
||||||
#include <memory>
|
#include <memory> // for unique_ptr, make_unique, allocator, operator==, default_delete
|
||||||
#include <string> // for basic_string, to_string, operator+, operator<=>
|
#include <stdexcept> // for runtime_error
|
||||||
#include <utility> // for pair, move
|
#include <string> // for basic_string, to_string, operator+, char_traits, operator<=>
|
||||||
|
#include <utility> // for move, pair
|
||||||
|
#include <vector> // for vector
|
||||||
|
|
||||||
#include <sys/epoll.h>
|
#include <sys/socket.h> // for send
|
||||||
#include <sys/types.h> // for ssize_t
|
#include <sys/types.h> // for ssize_t
|
||||||
|
|
||||||
Client::Client(std::unique_ptr<ClientSocket> socket, Server &server)
|
Client::Client(std::unique_ptr<ClientSocket> socket, Server &server)
|
||||||
: httpRequest_(std::make_unique<HttpRequest>(this)), httpResponse_(std::make_unique<HttpResponse>()),
|
: httpRequest_(std::make_unique<HttpRequest>(this)), httpResponse_(std::make_unique<HttpResponse>()),
|
||||||
|
|||||||
@ -2,25 +2,28 @@
|
|||||||
|
|
||||||
// #include <webserv/http/HttpResponse.hpp>
|
// #include <webserv/http/HttpResponse.hpp>
|
||||||
|
|
||||||
#include "webserv/handler/AHandler.hpp"
|
|
||||||
#include "webserv/router/Router.hpp"
|
|
||||||
#include "webserv/socket/ASocket.hpp"
|
|
||||||
#include "webserv/socket/CgiSocket.hpp"
|
|
||||||
|
|
||||||
#include <webserv/config/ServerConfig.hpp> // for ServerConfig
|
#include <webserv/config/ServerConfig.hpp> // for ServerConfig
|
||||||
|
#include <webserv/handler/AHandler.hpp> // for AHandler
|
||||||
#include <webserv/http/HttpConstants.hpp> // for OK
|
#include <webserv/http/HttpConstants.hpp> // for OK
|
||||||
#include <webserv/http/HttpRequest.hpp> // for HttpRequest
|
#include <webserv/http/HttpRequest.hpp> // for HttpRequest
|
||||||
#include <webserv/http/HttpResponse.hpp> // for HttpResponse
|
#include <webserv/http/HttpResponse.hpp> // for HttpResponse
|
||||||
|
#include <webserv/router/Router.hpp>
|
||||||
#include <webserv/server/Server.hpp>
|
#include <webserv/server/Server.hpp>
|
||||||
|
#include <webserv/socket/ASocket.hpp>
|
||||||
|
#include <webserv/socket/CgiSocket.hpp>
|
||||||
#include <webserv/socket/ClientSocket.hpp> // for ClientSocket
|
#include <webserv/socket/ClientSocket.hpp> // for ClientSocket
|
||||||
|
|
||||||
#include <cstddef> // for size_t
|
#include <cstddef> // for size_t
|
||||||
#include <memory> // for unique_ptr
|
#include <memory> // for unique_ptr
|
||||||
|
#include <unordered_map> // for unordered_map
|
||||||
|
|
||||||
class Server;
|
class Server;
|
||||||
class ClientSocket;
|
class ClientSocket;
|
||||||
class ServerConfig;
|
class ServerConfig;
|
||||||
class HttpResponse;
|
class HttpResponse;
|
||||||
|
class ASocket;
|
||||||
|
class HttpRequest;
|
||||||
|
class Router;
|
||||||
|
|
||||||
class Client
|
class Client
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
#include <webserv/config/AConfig.hpp> // for AConfig
|
#include <webserv/config/AConfig.hpp> // for AConfig
|
||||||
|
|
||||||
#include <webserv/config/directive/ADirective.hpp> // for ADirective
|
#include <webserv/config/directive/ADirective.hpp> // for ADirective
|
||||||
#include <webserv/config/directive/DirectiveFactory.hpp> // for DirectiveFactory
|
#include <webserv/config/directive/DirectiveFactory.hpp> // for DirectiveFactory
|
||||||
#include <webserv/config/directive/DirectiveValue.hpp> // for DirectiveValue
|
#include <webserv/config/directive/DirectiveValue.hpp> // for DirectiveValue
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
#include <webserv/config/ConfigManager.hpp>
|
#include <webserv/config/ConfigManager.hpp>
|
||||||
|
|
||||||
#include <webserv/config/GlobalConfig.hpp> // for GlobalConfig
|
#include <webserv/config/GlobalConfig.hpp> // for GlobalConfig
|
||||||
#include <webserv/log/Log.hpp> // for Log
|
#include <webserv/log/Log.hpp> // for Log
|
||||||
#include <webserv/utils/utils.hpp> // for removeComments
|
#include <webserv/utils/utils.hpp> // for removeComments
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#include <webserv/config/AConfig.hpp> // for AConfig
|
|
||||||
#include <webserv/config/LocationConfig.hpp>
|
#include <webserv/config/LocationConfig.hpp>
|
||||||
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
|
||||||
|
#include <webserv/config/AConfig.hpp> // for AConfig
|
||||||
|
|
||||||
LocationConfig::LocationConfig(const std::string &block, const std::string &path, const AConfig *parent)
|
LocationConfig::LocationConfig(const std::string &block, const std::string &path, const AConfig *parent)
|
||||||
: AConfig(parent), _path(path)
|
: AConfig(parent), _path(path)
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
#include <webserv/config/directive/ADirective.hpp>
|
#include <webserv/config/directive/ADirective.hpp>
|
||||||
|
|
||||||
#include <webserv/config/directive/DirectiveValue.hpp> // for DirectiveValue, operator<<
|
#include <webserv/config/directive/DirectiveValue.hpp> // for DirectiveValue, operator<<
|
||||||
#include <utility> // for move
|
|
||||||
|
|
||||||
ADirective::ADirective(std::string name) : name_(std::move(name)) //TODO Move here but derived classes take const ref
|
#include <utility> // for move
|
||||||
|
|
||||||
|
ADirective::ADirective(std::string name) : name_(std::move(name)) // TODO Move here but derived classes take const ref
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
|
#include <webserv/config/directive/SizeDirective.hpp> // for SizeDirective
|
||||||
|
|
||||||
#include <webserv/config/directive/ADirective.hpp> // for ADirective
|
#include <webserv/config/directive/ADirective.hpp> // for ADirective
|
||||||
#include <webserv/config/directive/DirectiveValue.hpp> // for DirectiveValueType
|
#include <webserv/config/directive/DirectiveValue.hpp> // for DirectiveValueType
|
||||||
#include <webserv/config/directive/SizeDirective.hpp> // for SizeDirective
|
|
||||||
#include <webserv/utils/utils.hpp> // for trim
|
#include <webserv/utils/utils.hpp> // for trim
|
||||||
|
|
||||||
#include <algorithm> // for __transform_fn, transform
|
#include <algorithm> // for __transform_fn, transform
|
||||||
#include <cctype> // for tolower
|
#include <cctype> // for tolower
|
||||||
|
#include <exception> // for exception
|
||||||
#include <stdexcept> // for invalid_argument
|
#include <stdexcept> // for invalid_argument
|
||||||
|
|
||||||
SizeDirective::SizeDirective(const std::string &name, const std::string &value)
|
SizeDirective::SizeDirective(const std::string &name, const std::string &value)
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
#include <webserv/config/validation/ConfigValidator.hpp>
|
#include <webserv/config/validation/ConfigValidator.hpp>
|
||||||
|
|
||||||
#include <webserv/config/validation/ValidationEngine.hpp> // for ValidationEngine
|
#include <webserv/config/validation/ValidationEngine.hpp> // for ValidationEngine
|
||||||
#include <webserv/config/validation/directive_rules/AValidationRule.hpp> // for AValidationRule
|
#include <webserv/config/validation/directive_rules/AValidationRule.hpp> // for AValidationRule
|
||||||
#include <webserv/config/validation/directive_rules/AllowedValuesRule.hpp> // for AllowedValuesRule
|
#include <webserv/config/validation/directive_rules/AllowedValuesRule.hpp> // for AllowedValuesRule
|
||||||
@ -36,9 +37,8 @@ ConfigValidator::ConfigValidator(const GlobalConfig *config) : engine_(std::make
|
|||||||
engine_->addServerRule("root", std::make_unique<FolderExistsRule>(false));
|
engine_->addServerRule("root", std::make_unique<FolderExistsRule>(false));
|
||||||
|
|
||||||
/*Location Directive Rules*/
|
/*Location Directive Rules*/
|
||||||
engine_->addLocationRule("allowed_methods",
|
engine_->addLocationRule("allowed_methods", std::make_unique<AllowedValuesRule>(
|
||||||
std::make_unique<AllowedValuesRule>(std::vector<std::string>{"GET", "POST", "DELETE", "PUT"},
|
std::vector<std::string>{"GET", "POST", "DELETE", "PUT"}, true));
|
||||||
true));
|
|
||||||
engine_->addLocationRule("root", std::make_unique<FolderExistsRule>(true));
|
engine_->addLocationRule("root", std::make_unique<FolderExistsRule>(true));
|
||||||
engine_->addLocationRule("cgi_ext", std::make_unique<CgiExtValidationRule>(false));
|
engine_->addLocationRule("cgi_ext", std::make_unique<CgiExtValidationRule>(false));
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
|
#include <webserv/config/validation/ValidationEngine.hpp>
|
||||||
|
|
||||||
#include <webserv/config/AConfig.hpp> // for AConfig
|
#include <webserv/config/AConfig.hpp> // for AConfig
|
||||||
#include <webserv/config/GlobalConfig.hpp> // for GlobalConfig
|
#include <webserv/config/GlobalConfig.hpp> // for GlobalConfig
|
||||||
#include <webserv/config/LocationConfig.hpp> // for LocationConfig
|
#include <webserv/config/LocationConfig.hpp> // for LocationConfig
|
||||||
#include <webserv/config/ServerConfig.hpp> // for ServerConfig
|
#include <webserv/config/ServerConfig.hpp> // for ServerConfig
|
||||||
#include <webserv/config/validation/ValidationEngine.hpp>
|
|
||||||
#include <webserv/config/validation/ValidationResult.hpp> // for ValidationResult
|
#include <webserv/config/validation/ValidationResult.hpp> // for ValidationResult
|
||||||
#include <webserv/config/validation/directive_rules/AValidationRule.hpp> // for AValidationRule
|
#include <webserv/config/validation/directive_rules/AValidationRule.hpp> // for AValidationRule
|
||||||
#include <webserv/config/validation/structural_rules/AStructuralValidationRule.hpp> // for AStructuralValidationRule
|
#include <webserv/config/validation/structural_rules/AStructuralValidationRule.hpp> // for AStructuralValidationRule
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
#include <webserv/config/validation/ValidationResult.hpp>
|
#include <webserv/config/validation/ValidationResult.hpp>
|
||||||
|
|
||||||
#include <webserv/log/Log.hpp> // for Log
|
#include <webserv/log/Log.hpp> // for Log
|
||||||
|
|
||||||
#include <utility> // for move
|
#include <utility> // for move
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <webserv/config/AConfig.hpp> // for AConfig
|
#include <webserv/config/AConfig.hpp> // for AConfig
|
||||||
#include <webserv/config/validation/ValidationResult.hpp> // for ValidationResult
|
#include <webserv/config/validation/ValidationResult.hpp> // for ValidationResult
|
||||||
#include <webserv/log/Log.hpp> // for LOCATION, Log
|
|
||||||
|
|
||||||
#include <utility> // for move
|
#include <utility> // for move
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,17 @@
|
|||||||
#include "webserv/log/Log.hpp"
|
#include <webserv/handler/AHandler.hpp> // for AHandler
|
||||||
|
|
||||||
#include <webserv/client/Client.hpp>
|
#include <webserv/client/Client.hpp> // for Client
|
||||||
#include <webserv/handler/AHandler.hpp>
|
#include <webserv/config/AConfig.hpp> // for AConfig
|
||||||
#include <webserv/handler/URI.hpp>
|
#include <webserv/handler/URI.hpp> // for URI
|
||||||
#include <webserv/http/HttpRequest.hpp>
|
#include <webserv/http/HttpRequest.hpp> // for HttpRequest
|
||||||
#include <webserv/http/HttpResponse.hpp>
|
#include <webserv/log/Log.hpp> // for Log
|
||||||
|
#include <webserv/socket/TimerSocket.hpp> // for TimerSocket
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono> // for operator*, milliseconds
|
||||||
#include <memory>
|
#include <functional> // for function
|
||||||
#include <string>
|
#include <memory> // for unique_ptr, make_unique
|
||||||
|
#include <optional> // for optional
|
||||||
|
#include <string> // for basic_string, operator+, to_string
|
||||||
|
|
||||||
AHandler::AHandler(const HttpRequest &request, HttpResponse &response) : request_(request), response_(response) {}
|
AHandler::AHandler(const HttpRequest &request, HttpResponse &response) : request_(request), response_(response) {}
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "webserv/socket/TimerSocket.hpp"
|
#include <webserv/socket/TimerSocket.hpp>
|
||||||
|
|
||||||
|
#include <memory> // for unique_ptr
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
class HttpRequest;
|
class HttpRequest;
|
||||||
class HttpResponse;
|
class HttpResponse;
|
||||||
|
class TimerSocket;
|
||||||
|
|
||||||
class AHandler
|
class AHandler
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
#include "webserv/handler/CgiEnvironment.hpp"
|
#include <webserv/handler/CgiEnvironment.hpp>
|
||||||
|
|
||||||
#include "webserv/log/Log.hpp"
|
#include <webserv/handler/URI.hpp> // for URI
|
||||||
|
#include <webserv/http/HttpHeaders.hpp> // for HttpHeaders
|
||||||
|
|
||||||
#include <cstring> // for strcpy
|
#include <cstring> // for strcpy, size_t
|
||||||
|
#include <optional> // for optional
|
||||||
|
#include <utility> // for pair
|
||||||
|
|
||||||
CgiEnvironment::CgiEnvironment(const URI &uri, const HttpRequest &request)
|
CgiEnvironment::CgiEnvironment(const URI &uri, const HttpRequest &request)
|
||||||
{
|
{
|
||||||
@ -46,8 +49,6 @@ CgiEnvironment::CgiEnvironment(const URI &uri, const HttpRequest &request)
|
|||||||
env_["HTTP_ACCEPT"] = headers.get("Accept");
|
env_["HTTP_ACCEPT"] = headers.get("Accept");
|
||||||
env_["HTTP_ACCEPT_LANGUAGE"] = headers.get("Accept-Language");
|
env_["HTTP_ACCEPT_LANGUAGE"] = headers.get("Accept-Language");
|
||||||
env_["HTTP_ACCEPT_ENCODING"] = headers.get("Accept-Encoding");
|
env_["HTTP_ACCEPT_ENCODING"] = headers.get("Accept-Encoding");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char **CgiEnvironment::toEnvp() const
|
char **CgiEnvironment::toEnvp() const
|
||||||
|
|||||||
@ -1,21 +1,22 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <map>
|
#include <webserv/handler/URI.hpp>
|
||||||
#include <string>
|
#include <webserv/http/HttpRequest.hpp> // for HttpRequest
|
||||||
#include "webserv/handler/URI.hpp"
|
#include <webserv/log/Log.hpp>
|
||||||
#include "webserv/http/HttpRequest.hpp"
|
#include <webserv/utils/FileUtils.hpp>
|
||||||
#include "webserv/utils/FileUtils.hpp"
|
|
||||||
#include "webserv/log/Log.hpp"
|
#include <map> // for map
|
||||||
|
#include <string> // for basic_string, string
|
||||||
|
|
||||||
|
class URI;
|
||||||
|
|
||||||
class CgiEnvironment
|
class CgiEnvironment
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CgiEnvironment(const URI &uri, const HttpRequest &request);
|
CgiEnvironment(const URI &uri, const HttpRequest &request);
|
||||||
|
|
||||||
[[nodiscard]] char **toEnvp() const;
|
[[nodiscard]] char **toEnvp() const;
|
||||||
|
|
||||||
|
private:
|
||||||
private:
|
std::map<std::string, std::string> env_;
|
||||||
std::map<std::string, std::string> env_;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,15 +1,19 @@
|
|||||||
#include "webserv/handler/ErrorHandler.hpp"
|
#include <webserv/handler/CgiHandler.hpp>
|
||||||
|
|
||||||
#include <webserv/client/Client.hpp> // for Client
|
#include <webserv/client/Client.hpp> // for Client
|
||||||
#include <webserv/handler/CgiHandler.hpp>
|
#include <webserv/handler/CgiProcess.hpp> // for CgiProcess
|
||||||
#include <webserv/handler/CgiProcess.hpp> // for CgiProcess
|
#include <webserv/handler/ErrorHandler.hpp> // for ErrorHandler
|
||||||
#include <webserv/http/HttpRequest.hpp> // for HttpRequest
|
#include <webserv/http/HttpRequest.hpp> // for HttpRequest
|
||||||
#include <webserv/http/HttpResponse.hpp> // for HttpResponse
|
#include <webserv/http/HttpResponse.hpp> // for HttpResponse
|
||||||
#include <webserv/log/Log.hpp> // for Log
|
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
||||||
#include <webserv/socket/CgiSocket.hpp> // for CgiSocket
|
#include <webserv/socket/CgiSocket.hpp> // for CgiSocket
|
||||||
#include <webserv/utils/utils.hpp> // for stoul
|
#include <webserv/socket/TimerSocket.hpp> // for TimerSocket
|
||||||
|
#include <webserv/utils/utils.hpp> // for trim
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <functional> // for function
|
||||||
|
#include <utility> // for move
|
||||||
|
|
||||||
|
#include <sys/types.h> // for ssize_t
|
||||||
|
|
||||||
CgiHandler::CgiHandler(const HttpRequest &request, HttpResponse &response)
|
CgiHandler::CgiHandler(const HttpRequest &request, HttpResponse &response)
|
||||||
: AHandler(request, response), cgiProcess_(nullptr), cgiStdIn_(nullptr), cgiStdOut_(nullptr)
|
: AHandler(request, response), cgiProcess_(nullptr), cgiStdIn_(nullptr), cgiStdOut_(nullptr)
|
||||||
|
|||||||
@ -1,11 +1,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "webserv/handler/AHandler.hpp"
|
#include <webserv/handler/AHandler.hpp> // for AHandler
|
||||||
#include "webserv/socket/CgiSocket.hpp"
|
#include <webserv/http/HttpRequest.hpp> // for HttpRequest
|
||||||
|
#include <webserv/socket/CgiSocket.hpp> // for CgiSocket
|
||||||
|
|
||||||
#include <memory>
|
#include <memory> // for unique_ptr
|
||||||
|
#include <string> // for string
|
||||||
|
#include <vector> // for vector
|
||||||
|
|
||||||
|
#include <stddef.h> // for size_t
|
||||||
|
#include <stdint.h> // for uint8_t
|
||||||
|
|
||||||
class CgiProcess;
|
class CgiProcess;
|
||||||
|
class HttpResponse;
|
||||||
|
|
||||||
class CgiHandler : public AHandler
|
class CgiHandler : public AHandler
|
||||||
{
|
{
|
||||||
@ -21,7 +28,8 @@ class CgiHandler : public AHandler
|
|||||||
|
|
||||||
void handle() override;
|
void handle() override;
|
||||||
void wait() noexcept;
|
void wait() noexcept;
|
||||||
void setCgiSockets(std::unique_ptr<CgiSocket> cgiStdIn, std::unique_ptr<CgiSocket> cgiStdOut, std::unique_ptr<CgiSocket> cgiStdErr);
|
void setCgiSockets(std::unique_ptr<CgiSocket> cgiStdIn, std::unique_ptr<CgiSocket> cgiStdOut,
|
||||||
|
std::unique_ptr<CgiSocket> cgiStdErr);
|
||||||
void setPid(int pid);
|
void setPid(int pid);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -42,7 +50,6 @@ class CgiHandler : public AHandler
|
|||||||
|
|
||||||
int pid_ = -1;
|
int pid_ = -1;
|
||||||
|
|
||||||
|
|
||||||
void write();
|
void write();
|
||||||
void read();
|
void read();
|
||||||
void error();
|
void error();
|
||||||
|
|||||||
@ -1,22 +1,23 @@
|
|||||||
#include "webserv/handler/CgiProcess.hpp"
|
#include <webserv/handler/CgiProcess.hpp>
|
||||||
|
|
||||||
#include "webserv/handler/CgiEnvironment.hpp"
|
#include <webserv/handler/CgiEnvironment.hpp> // for CgiEnvironment
|
||||||
#include "webserv/http/HttpRequest.hpp"
|
#include <webserv/handler/CgiHandler.hpp> // for CgiHandler
|
||||||
#include "webserv/log/Log.hpp"
|
#include <webserv/handler/URI.hpp> // for URI
|
||||||
#include "webserv/socket/CgiSocket.hpp"
|
#include <webserv/http/HttpRequest.hpp> // for HttpRequest
|
||||||
|
#include <webserv/log/Log.hpp> // for Log
|
||||||
|
#include <webserv/socket/ASocket.hpp> // for ASocket
|
||||||
|
#include <webserv/socket/CgiSocket.hpp> // for CgiSocket
|
||||||
|
|
||||||
#include <webserv/handler/URI.hpp>
|
#include <csignal> // for kill, SIGKILL
|
||||||
|
#include <cstdlib> // for exit
|
||||||
|
#include <memory> // for allocator, make_unique, unique_ptr
|
||||||
|
#include <stdexcept> // for runtime_error
|
||||||
|
#include <string> // for basic_string, operator+, to_string, char_traits, string
|
||||||
|
#include <utility> // for move
|
||||||
|
|
||||||
#include <csignal>
|
#include <fcntl.h> // for O_CLOEXEC, O_NONBLOCK
|
||||||
#include <cstdlib>
|
#include <sys/wait.h> // for waitpid, WNOHANG
|
||||||
#include <iostream>
|
#include <unistd.h> // for close, dup2, pipe2, execve, fork, STDERR_FILENO, STDIN_FILENO, STDOUT_FILENO
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
CgiProcess::CgiProcess(const HttpRequest &request, CgiHandler &handler) : request_(request), handler_(handler), _pid(-1)
|
CgiProcess::CgiProcess(const HttpRequest &request, CgiHandler &handler) : request_(request), handler_(handler), _pid(-1)
|
||||||
{
|
{
|
||||||
@ -41,7 +42,8 @@ void CgiProcess::spawn()
|
|||||||
int pipeStdout[2];
|
int pipeStdout[2];
|
||||||
int pipeStderr[2];
|
int pipeStderr[2];
|
||||||
|
|
||||||
if (pipe2(pipeStdin, O_CLOEXEC | O_NONBLOCK) == -1 || pipe2(pipeStdout, O_CLOEXEC | O_NONBLOCK) == -1 || pipe2(pipeStderr, O_CLOEXEC | O_NONBLOCK) == -1)
|
if (pipe2(pipeStdin, O_CLOEXEC | O_NONBLOCK) == -1 || pipe2(pipeStdout, O_CLOEXEC | O_NONBLOCK) == -1
|
||||||
|
|| pipe2(pipeStderr, O_CLOEXEC | O_NONBLOCK) == -1)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Failed to create pipes");
|
throw std::runtime_error("Failed to create pipes");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "webserv/handler/CgiHandler.hpp"
|
#include <webserv/handler/CgiHandler.hpp>
|
||||||
#include "webserv/http/HttpRequest.hpp"
|
#include <webserv/http/HttpRequest.hpp> // for HttpRequest
|
||||||
|
|
||||||
|
class CgiHandler;
|
||||||
|
|
||||||
class CgiProcess
|
class CgiProcess
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
|
#include <webserv/handler/ErrorHandler.hpp> // for ErrorHandler
|
||||||
|
|
||||||
#include <webserv/config/AConfig.hpp> // for AConfig
|
#include <webserv/config/AConfig.hpp> // for AConfig
|
||||||
#include <webserv/config/ConfigManager.hpp> // for ConfigManager
|
#include <webserv/config/ConfigManager.hpp> // for ConfigManager
|
||||||
#include <webserv/config/GlobalConfig.hpp> // for GlobalConfig
|
#include <webserv/config/GlobalConfig.hpp> // for GlobalConfig
|
||||||
#include <webserv/handler/ErrorHandler.hpp> // for ErrorHandler
|
|
||||||
#include <webserv/http/HttpConstants.hpp> // for getStatusCodeReason, INTERNAL_SERVER_ERROR
|
#include <webserv/http/HttpConstants.hpp> // for getStatusCodeReason, INTERNAL_SERVER_ERROR
|
||||||
#include <webserv/http/HttpResponse.hpp> // for HttpResponse
|
#include <webserv/http/HttpResponse.hpp> // for HttpResponse
|
||||||
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
||||||
|
|
||||||
#include <fstream> // for basic_ifstream, basic_filebuf, basic_ostream::operator<<, ifstream, stringstream
|
#include <fstream> // for basic_ifstream, basic_filebuf, basic_ostream::operator<<, ifstream, stringstream
|
||||||
#include <memory> // for allocator, make_unique, unique_ptr
|
|
||||||
#include <sstream> // for basic_stringstream
|
#include <sstream> // for basic_stringstream
|
||||||
#include <string> // for basic_string, char_traits, operator+, string, to_string
|
#include <string> // for allocator, basic_string, char_traits, operator+, string, to_string
|
||||||
|
|
||||||
void ErrorHandler::createErrorResponse(uint16_t statusCode, HttpResponse &response, const AConfig *config)
|
void ErrorHandler::createErrorResponse(uint16_t statusCode, HttpResponse &response, const AConfig *config)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
class AConfig;
|
class AConfig;
|
||||||
|
class HttpResponse;
|
||||||
|
|
||||||
class ErrorHandler
|
class ErrorHandler
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
|
#include <webserv/handler/FileHandler.hpp>
|
||||||
|
|
||||||
#include <webserv/config/AConfig.hpp> // for AConfig
|
#include <webserv/config/AConfig.hpp> // for AConfig
|
||||||
#include <webserv/handler/ErrorHandler.hpp> // for ErrorHandler
|
#include <webserv/handler/ErrorHandler.hpp> // for ErrorHandler
|
||||||
#include <webserv/handler/FileHandler.hpp>
|
|
||||||
#include <webserv/handler/MIMETypes.hpp> // for MIMETypes
|
#include <webserv/handler/MIMETypes.hpp> // for MIMETypes
|
||||||
#include <webserv/handler/URI.hpp> // for URI
|
#include <webserv/handler/URI.hpp> // for URI
|
||||||
#include <webserv/http/HttpConstants.hpp> // for NOT_FOUND, FORBIDDEN, OK
|
#include <webserv/http/HttpConstants.hpp> // for NOT_FOUND, FORBIDDEN, OK
|
||||||
@ -8,10 +9,9 @@
|
|||||||
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
||||||
#include <webserv/utils/FileUtils.hpp> // for joinPath, getExtension, isFile, readBinaryFile
|
#include <webserv/utils/FileUtils.hpp> // for joinPath, getExtension, isFile, readBinaryFile
|
||||||
|
|
||||||
#include <memory> // for unique_ptr, allocator, make_unique
|
|
||||||
#include <optional> // for optional
|
#include <optional> // for optional
|
||||||
#include <ranges> // for __find_if_fn, find_if
|
#include <ranges> // for __find_if_fn, find_if
|
||||||
#include <string> // for basic_string, string, operator+, char_traits
|
#include <string> // for basic_string, allocator, operator+, string, char_traits
|
||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
|
|
||||||
FileHandler::FileHandler(const HttpRequest &request, HttpResponse &response)
|
FileHandler::FileHandler(const HttpRequest &request, HttpResponse &response)
|
||||||
@ -91,16 +91,10 @@ void FileHandler::handle()
|
|||||||
|
|
||||||
switch (resourceType)
|
switch (resourceType)
|
||||||
{
|
{
|
||||||
case FILE:
|
case FILE: handleFile(filepath); return;
|
||||||
handleFile(filepath);
|
|
||||||
return;
|
|
||||||
case DIRECTORY_AUTOINDEX:
|
case DIRECTORY_AUTOINDEX:
|
||||||
case DIRECTORY_INDEX:
|
case DIRECTORY_INDEX: handleDirectory(filepath, resourceType); return;
|
||||||
handleDirectory(filepath, resourceType);
|
case NOT_FOUND: ErrorHandler::createErrorResponse(Http::StatusCode::NOT_FOUND, response_, config_); return;
|
||||||
return;
|
|
||||||
case NOT_FOUND:
|
|
||||||
ErrorHandler::createErrorResponse(Http::StatusCode::NOT_FOUND, response_, config_);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
ErrorHandler::createErrorResponse(Http::StatusCode::NOT_FOUND, response_, config_);
|
ErrorHandler::createErrorResponse(Http::StatusCode::NOT_FOUND, response_, config_);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "webserv/http/HttpRequest.hpp"
|
|
||||||
|
|
||||||
#include <webserv/config/AConfig.hpp>
|
#include <webserv/config/AConfig.hpp>
|
||||||
#include <webserv/handler/AHandler.hpp>
|
|
||||||
#include <webserv/config/LocationConfig.hpp>
|
#include <webserv/config/LocationConfig.hpp>
|
||||||
|
#include <webserv/handler/AHandler.hpp> // for AHandler
|
||||||
#include <webserv/handler/URI.hpp>
|
#include <webserv/handler/URI.hpp>
|
||||||
|
#include <webserv/http/HttpRequest.hpp> // for HttpRequest
|
||||||
#include <webserv/http/HttpResponse.hpp> // for HttpResponse
|
#include <webserv/http/HttpResponse.hpp> // for HttpResponse
|
||||||
|
|
||||||
#include <cstdint> // for uint8_t
|
#include <cstdint> // for uint8_t
|
||||||
@ -14,6 +13,7 @@
|
|||||||
|
|
||||||
class AConfig;
|
class AConfig;
|
||||||
class URI;
|
class URI;
|
||||||
|
class HttpResponse;
|
||||||
|
|
||||||
class FileHandler : public AHandler
|
class FileHandler : public AHandler
|
||||||
{
|
{
|
||||||
@ -33,8 +33,9 @@ class FileHandler : public AHandler
|
|||||||
void handleTimeout() override;
|
void handleTimeout() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const URI &uri_;
|
const URI &uri_;
|
||||||
const AConfig *config_;
|
const AConfig *config_;
|
||||||
|
|
||||||
enum ResourceType : uint8_t
|
enum ResourceType : uint8_t
|
||||||
{
|
{
|
||||||
FILE,
|
FILE,
|
||||||
|
|||||||
@ -1,14 +1,16 @@
|
|||||||
#include "webserv/log/Log.hpp"
|
#include <webserv/handler/URI.hpp>
|
||||||
|
|
||||||
#include <webserv/config/AConfig.hpp> // for AConfig
|
#include <webserv/config/AConfig.hpp> // for AConfig
|
||||||
#include <webserv/config/LocationConfig.hpp> // for LocationConfig
|
#include <webserv/config/LocationConfig.hpp> // for LocationConfig
|
||||||
#include <webserv/config/ServerConfig.hpp> // for ServerConfig
|
#include <webserv/config/ServerConfig.hpp> // for ServerConfig
|
||||||
#include <webserv/handler/URI.hpp>
|
|
||||||
#include <webserv/http/HttpHeaders.hpp> // for HttpHeaders
|
#include <webserv/http/HttpHeaders.hpp> // for HttpHeaders
|
||||||
#include <webserv/utils/FileUtils.hpp> // for joinPath, getExtension, isDirectory, isFile, isValidPath
|
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
||||||
|
#include <webserv/utils/FileUtils.hpp> // for joinPath, isDirectory, isFile, getExtension, isValidPath
|
||||||
#include <webserv/utils/utils.hpp> // for trim, split
|
#include <webserv/utils/utils.hpp> // for trim, split
|
||||||
|
|
||||||
#include <cstddef> // for size_t
|
#include <cstddef> // for size_t
|
||||||
|
#include <format> // for vector
|
||||||
|
#include <map> // for map
|
||||||
#include <optional> // for optional, operator!=
|
#include <optional> // for optional, operator!=
|
||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
#include <webserv/http/HttpRequest.hpp> // for HttpRequest
|
#include <webserv/http/HttpRequest.hpp> // for HttpRequest
|
||||||
#include <webserv/server/Server.hpp>
|
#include <webserv/server/Server.hpp>
|
||||||
|
|
||||||
|
|
||||||
#include <string> // for string, basic_string
|
#include <string> // for string, basic_string
|
||||||
|
|
||||||
class LocationConfig;
|
class LocationConfig;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include <webserv/http/HttpConstants.hpp> // for CRLF
|
|
||||||
#include <webserv/http/HttpHeaders.hpp> // for HttpHeaders
|
#include <webserv/http/HttpHeaders.hpp> // for HttpHeaders
|
||||||
|
|
||||||
|
#include <webserv/http/HttpConstants.hpp> // for CRLF
|
||||||
#include <webserv/log/Log.hpp>
|
#include <webserv/log/Log.hpp>
|
||||||
#include <webserv/utils/utils.hpp> // for trim
|
#include <webserv/utils/utils.hpp> // for trim
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,17 @@
|
|||||||
#include "webserv/config/ConfigManager.hpp"
|
|
||||||
#include "webserv/config/ServerConfig.hpp"
|
|
||||||
#include "webserv/handler/URI.hpp"
|
|
||||||
|
|
||||||
#include <webserv/client/Client.hpp> // for Client
|
|
||||||
#include <webserv/http/HttpConstants.hpp> // for CRLF, DOUBLE_CRLF, BAD_REQUEST
|
|
||||||
#include <webserv/http/HttpRequest.hpp>
|
#include <webserv/http/HttpRequest.hpp>
|
||||||
|
|
||||||
|
#include <webserv/config/ConfigManager.hpp> // for ConfigManager
|
||||||
|
#include <webserv/handler/URI.hpp> // for URI
|
||||||
|
#include <webserv/http/HttpConstants.hpp> // for CRLF, DOUBLE_CRLF
|
||||||
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
||||||
#include <webserv/utils/utils.hpp> // for stoul
|
#include <webserv/utils/utils.hpp> // for stoul
|
||||||
|
|
||||||
#include <map> // for map
|
#include <exception> // for exception
|
||||||
#include <memory>
|
#include <map> // for map
|
||||||
#include <optional> // for optional
|
#include <memory> // for allocator, make_unique, unique_ptr
|
||||||
#include <sstream> // for basic_stringstream, basic_istream, stringstream
|
#include <optional> // for optional
|
||||||
#include <utility> // for pair
|
#include <sstream> // for basic_stringstream, basic_istream, stringstream
|
||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
|
|
||||||
HttpRequest::HttpRequest(Client *client) : client_(client), uri_(nullptr)
|
HttpRequest::HttpRequest(Client *client) : client_(client), uri_(nullptr)
|
||||||
{
|
{
|
||||||
@ -43,8 +41,7 @@ void HttpRequest::setState(State state)
|
|||||||
state_ = State::ParseError;
|
state_ = State::ParseError;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uri_ = std::make_unique<URI>(
|
uri_ = std::make_unique<URI>(*this, *serverConfig);
|
||||||
*this, *serverConfig);
|
|
||||||
}
|
}
|
||||||
state_ = state;
|
state_ = state;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
#include <cstddef> // for size_t
|
#include <cstddef> // for size_t
|
||||||
#include <cstdint> // for uint8_t
|
#include <cstdint> // for uint8_t
|
||||||
#include <memory>
|
#include <memory> // for unique_ptr
|
||||||
#include <string> // for string, basic_string
|
#include <string> // for string, basic_string
|
||||||
|
|
||||||
class Client;
|
class Client;
|
||||||
class ServerConfig;
|
class ServerConfig;
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#include <webserv/http/HttpConstants.hpp> // for getStatusCodeReason
|
|
||||||
#include <webserv/http/HttpResponse.hpp>
|
#include <webserv/http/HttpResponse.hpp>
|
||||||
|
|
||||||
|
#include <webserv/http/HttpConstants.hpp> // for getStatusCodeReason
|
||||||
|
|
||||||
#include <string> // for basic_string, operator+, string, char_traits, to_string
|
#include <string> // for basic_string, operator+, string, char_traits, to_string
|
||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
#include <webserv/log/Log.hpp> // for LOCATION, Log
|
#include <webserv/log/Log.hpp> // for LOCATION, Log
|
||||||
|
|
||||||
#include <cstdint> // for uint8_t, uint16_t
|
#include <cstdint> // for uint8_t, uint16_t
|
||||||
|
#include <format> // for vector
|
||||||
#include <memory> // for unique_ptr
|
#include <memory> // for unique_ptr
|
||||||
#include <string> // for string
|
#include <string> // for string
|
||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
#include <webserv/log/FileChannel.hpp>
|
#include <webserv/log/FileChannel.hpp>
|
||||||
|
|
||||||
#include <webserv/log/Log.hpp> // for Log
|
#include <webserv/log/Log.hpp> // for Log
|
||||||
|
|
||||||
#include <chrono> // for system_clock
|
#include <chrono> // for system_clock
|
||||||
#include <cstdio>
|
|
||||||
#include <ctime> // for localtime, tm
|
#include <ctime> // for localtime, tm
|
||||||
#include <iomanip> // for operator<<, put_time
|
#include <iomanip> // for operator<<, put_time
|
||||||
#include <iostream> // for cerr
|
#include <iostream> // for cerr
|
||||||
|
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
struct tm;
|
struct tm;
|
||||||
|
|
||||||
FileChannel::FileChannel(const std::string &filename) : filename_(filename), fileStream_(filename, std::ios_base::trunc)
|
FileChannel::FileChannel(const std::string &filename) : filename_(filename), fileStream_(filename, std::ios_base::trunc)
|
||||||
|
|||||||
@ -4,10 +4,10 @@
|
|||||||
#include <webserv/log/Log.hpp> // for Log
|
#include <webserv/log/Log.hpp> // for Log
|
||||||
#include <webserv/server/Server.hpp> // for Server
|
#include <webserv/server/Server.hpp> // for Server
|
||||||
|
|
||||||
|
#include <csignal>
|
||||||
#include <iostream> // for ios_base
|
#include <iostream> // for ios_base
|
||||||
#include <string> // for allocator, basic_string, char_traits, operator+, string
|
#include <string> // for allocator, basic_string, char_traits, operator+, string
|
||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
#include <csignal>
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,21 +1,25 @@
|
|||||||
#include "webserv/handler/CgiProcess.hpp"
|
#include <webserv/router/Router.hpp> // for Router
|
||||||
|
|
||||||
|
#include <webserv/client/Client.hpp> // for Client
|
||||||
#include <webserv/config/AConfig.hpp> // for AConfig
|
#include <webserv/config/AConfig.hpp> // for AConfig
|
||||||
#include <webserv/config/ConfigManager.hpp> // for ConfigManager
|
|
||||||
#include <webserv/config/directive/ADirective.hpp> // for ADirective
|
#include <webserv/config/directive/ADirective.hpp> // for ADirective
|
||||||
#include <webserv/config/directive/DirectiveValue.hpp> // for DirectiveValue
|
#include <webserv/config/directive/DirectiveValue.hpp> // for DirectiveValue
|
||||||
#include <webserv/handler/ErrorHandler.hpp> // for ErrorHandler
|
#include <webserv/handler/CgiHandler.hpp> // for CgiHandler
|
||||||
|
#include <webserv/handler/CgiProcess.hpp> // for CgiProcess
|
||||||
#include <webserv/handler/FileHandler.hpp> // for FileHandler
|
#include <webserv/handler/FileHandler.hpp> // for FileHandler
|
||||||
#include <webserv/handler/URI.hpp> // for URI
|
#include <webserv/handler/URI.hpp> // for URI
|
||||||
#include <webserv/http/HttpHeaders.hpp> // for HttpHeaders
|
#include <webserv/http/HttpRequest.hpp> // for HttpRequest
|
||||||
#include <webserv/log/Log.hpp> // for LOCATION, Log
|
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
||||||
#include <webserv/router/Router.hpp>
|
|
||||||
|
|
||||||
#include <memory> // for unique_ptr
|
#include <exception> // for exception
|
||||||
#include <optional> // for optional
|
#include <format> // for vector
|
||||||
#include <ranges> // for __find_fn, find
|
#include <memory> // for unique_ptr, make_unique
|
||||||
#include <string> // for basic_string, string
|
#include <optional> // for optional
|
||||||
#include <vector> // for vector
|
#include <ranges> // for __find_fn, find
|
||||||
|
#include <string> // for basic_string, string, operator+
|
||||||
|
#include <vector> // for vector
|
||||||
|
|
||||||
|
class HttpResponse;
|
||||||
|
|
||||||
Router::Router(Client *client) : client_(client)
|
Router::Router(Client *client) : client_(client)
|
||||||
{
|
{
|
||||||
@ -41,7 +45,7 @@ std::unique_ptr<AHandler> Router::handleRequest()
|
|||||||
if (request.getState() == HttpRequest::State::ParseError)
|
if (request.getState() == HttpRequest::State::ParseError)
|
||||||
{
|
{
|
||||||
Log::error("Router::handleRequest() called with incomplete request");
|
Log::error("Router::handleRequest() called with incomplete request");
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
HttpResponse &response = client_->getHttpResponse();
|
HttpResponse &response = client_->getHttpResponse();
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "webserv/handler/AHandler.hpp"
|
|
||||||
#include <webserv/config/AConfig.hpp> // for AConfig
|
#include <webserv/config/AConfig.hpp> // for AConfig
|
||||||
#include <webserv/config/LocationConfig.hpp>
|
#include <webserv/config/LocationConfig.hpp>
|
||||||
|
#include <webserv/handler/AHandler.hpp> // for AHandler
|
||||||
#include <webserv/http/HttpRequest.hpp> // for HttpRequest
|
#include <webserv/http/HttpRequest.hpp> // for HttpRequest
|
||||||
#include <webserv/http/HttpResponse.hpp> // for HttpResponse
|
#include <webserv/http/HttpResponse.hpp> // for HttpResponse
|
||||||
|
|
||||||
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
class LocationConfig;
|
class LocationConfig;
|
||||||
class ServerConfig;
|
class ServerConfig;
|
||||||
|
class Client;
|
||||||
|
|
||||||
class Router
|
class Router
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,33 +1,31 @@
|
|||||||
#include "webserv/utils/utils.hpp"
|
#include <webserv/server/Server.hpp>
|
||||||
|
|
||||||
#include <webserv/client/Client.hpp> // for Client
|
#include <webserv/client/Client.hpp> // for Client
|
||||||
#include <webserv/config/ConfigManager.hpp> // for ConfigManager
|
#include <webserv/config/ConfigManager.hpp> // for ConfigManager
|
||||||
#include <webserv/config/ServerConfig.hpp> // for ServerConfig
|
#include <webserv/config/ServerConfig.hpp> // for ServerConfig
|
||||||
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
||||||
#include <webserv/server/Server.hpp>
|
#include <webserv/socket/ASocket.hpp> // for ASocket
|
||||||
#include <webserv/socket/ASocket.hpp>
|
|
||||||
#include <webserv/socket/ClientSocket.hpp> // for ClientSocket
|
#include <webserv/socket/ClientSocket.hpp> // for ClientSocket
|
||||||
#include <webserv/socket/ServerSocket.hpp> // for ServerSocket
|
#include <webserv/socket/ServerSocket.hpp> // for ServerSocket
|
||||||
|
#include <webserv/utils/utils.hpp> // for stateToEpoll
|
||||||
|
|
||||||
#include <cerrno> // for errno
|
#include <cerrno> // for errno, EBADF, ENOENT, EINTR
|
||||||
|
#include <csignal> // for SIGINT, sig_atomic_t
|
||||||
#include <cstring> // for strerror
|
#include <cstring> // for strerror
|
||||||
#include <exception> // for exception
|
#include <exception> // for exception
|
||||||
#include <memory> // for unique_ptr, allocator, make_unique
|
#include <memory> // for unique_ptr, allocator, make_unique
|
||||||
#include <optional> // for optional
|
#include <optional> // for optional
|
||||||
#include <stdexcept> // for runtime_error
|
#include <stdexcept> // for runtime_error, invalid_argument
|
||||||
#include <string> // for basic_string, operator+, to_string, char_traits, string
|
#include <string> // for basic_string, operator+, to_string, char_traits, string
|
||||||
#include <unordered_map> // for unordered_map, operator==
|
#include <unordered_map> // for unordered_map
|
||||||
#include <utility> // for move, pair
|
#include <utility> // for move
|
||||||
#include <vector> // for vector
|
#include <vector> // for vector, erase_if
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h> // for O_CLOEXEC
|
||||||
#include <sys/epoll.h> // for epoll_event, epoll_ctl, EPOLLIN, EPOLLOUT, epoll_create1, epoll_wait, EPOLLERR, EPOLLHUP, EPOLL_CTL_ADD, EPOLL_CTL_DEL, EPOLL_CTL_MOD
|
#include <stdint.h> // for uint32_t
|
||||||
#include <sys/socket.h> // for send, SOMAXCONN
|
#include <sys/epoll.h> // for epoll_event, epoll_ctl, EPOLLOUT, EPOLL_CTL_MOD, epoll_create1, epoll_wait, EPOLLERR, EPOLLHUP, EPOLLIN, EPOLL_CTL_ADD, EPOLL_CTL_DEL
|
||||||
#include <sys/types.h> // for ssize_t
|
#include <sys/socket.h> // for SOMAXCONN
|
||||||
#include <unistd.h> // for close
|
#include <unistd.h> // for close
|
||||||
#include <csignal>
|
|
||||||
|
|
||||||
class Router;
|
|
||||||
|
|
||||||
volatile sig_atomic_t Server::stop_ = 0;
|
volatile sig_atomic_t Server::stop_ = 0;
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
#include <webserv/socket/ASocket.hpp>
|
#include <webserv/socket/ASocket.hpp>
|
||||||
#include <webserv/socket/ServerSocket.hpp> // for ServerSocket
|
#include <webserv/socket/ServerSocket.hpp> // for ServerSocket
|
||||||
|
|
||||||
#include <csignal>
|
#include <csignal> // for sig_atomic_t
|
||||||
#include <cstdint> // for uint32_t
|
#include <cstdint> // for uint32_t
|
||||||
#include <memory> // for unique_ptr
|
#include <memory> // for unique_ptr
|
||||||
#include <set> // for set
|
#include <set> // for set
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
|
||||||
#include <webserv/socket/ASocket.hpp>
|
#include <webserv/socket/ASocket.hpp>
|
||||||
|
|
||||||
|
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
||||||
|
|
||||||
#include <stdexcept> // for runtime_error
|
#include <stdexcept> // for runtime_error
|
||||||
#include <string> // for basic_string
|
#include <string> // for operator+, basic_string, to_string, allocator, char_traits, string
|
||||||
#include <system_error> // for generic_category, system_error
|
#include <system_error> // for generic_category, system_error
|
||||||
|
#include <utility> // for move
|
||||||
|
|
||||||
#include <errno.h> // for errno
|
#include <errno.h> // for errno
|
||||||
#include <fcntl.h> // for fcntl, F_SETFL, O_NONBLOCK
|
#include <fcntl.h> // for fcntl, FD_CLOEXEC, F_GETFD, F_GETFL, O_NONBLOCK, F_SETFD, F_SETFL
|
||||||
#include <sys/socket.h> // for recv, send
|
#include <sys/socket.h> // for recv, send
|
||||||
#include <unistd.h> // for close
|
#include <unistd.h> // for close
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,12 @@
|
|||||||
#include <webserv/log/Log.hpp> // for LOCATION, Log
|
|
||||||
#include <webserv/socket/ASocket.hpp> // for ASocket
|
|
||||||
#include <webserv/socket/CgiSocket.hpp>
|
#include <webserv/socket/CgiSocket.hpp>
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <webserv/log/Log.hpp> // for LOCATION, Log
|
||||||
|
#include <webserv/socket/ASocket.hpp> // for ASocket
|
||||||
|
|
||||||
|
#include <system_error> // for generic_category, system_error
|
||||||
|
|
||||||
|
#include <errno.h> // for errno
|
||||||
|
#include <unistd.h> // for read, write
|
||||||
|
|
||||||
CgiSocket::CgiSocket(int fd, ASocket::IoState event) : ASocket(fd, event)
|
CgiSocket::CgiSocket(int fd, ASocket::IoState event) : ASocket(fd, event)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
#include <webserv/socket/ASocket.hpp> // for ASocket
|
#include <webserv/socket/ASocket.hpp> // for ASocket
|
||||||
|
|
||||||
|
#include <stddef.h> // for size_t
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h> // for ssize_t
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
class CgiSocket : public ASocket
|
class CgiSocket : public ASocket
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
|
#include <webserv/socket/ClientSocket.hpp>
|
||||||
|
|
||||||
#include <webserv/log/Log.hpp> // for LOCATION, Log
|
#include <webserv/log/Log.hpp> // for LOCATION, Log
|
||||||
#include <webserv/socket/ASocket.hpp> // for ASocket
|
#include <webserv/socket/ASocket.hpp> // for ASocket
|
||||||
#include <webserv/socket/ClientSocket.hpp>
|
|
||||||
|
|
||||||
ClientSocket::ClientSocket(int fd) : ASocket(fd)
|
ClientSocket::ClientSocket(int fd) : ASocket(fd)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,13 +1,15 @@
|
|||||||
|
#include <webserv/socket/ServerSocket.hpp>
|
||||||
|
|
||||||
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
||||||
#include <webserv/socket/ASocket.hpp> // for ASocket
|
#include <webserv/socket/ASocket.hpp> // for ASocket
|
||||||
#include <webserv/socket/ClientSocket.hpp> // for ClientSocket
|
#include <webserv/socket/ClientSocket.hpp> // for ClientSocket
|
||||||
#include <webserv/socket/ServerSocket.hpp>
|
|
||||||
|
|
||||||
#include <memory> // for allocator, make_unique, unique_ptr
|
#include <memory> // for allocator, make_unique, unique_ptr
|
||||||
#include <stdexcept> // for runtime_error
|
#include <stdexcept> // for runtime_error
|
||||||
|
|
||||||
#include <arpa/inet.h> // for htons, inet_addr
|
#include <arpa/inet.h> // for htons, inet_addr
|
||||||
#include <netinet/in.h> // for sockaddr_in, in_addr
|
#include <netinet/in.h> // for sockaddr_in, in_addr
|
||||||
|
#include <stdint.h> // for uint16_t
|
||||||
#include <sys/socket.h> // for AF_INET, accept, bind, listen, setsockopt, socket, SOCK_STREAM, SOL_SOCKET, SO_REUSEADDR
|
#include <sys/socket.h> // for AF_INET, accept, bind, listen, setsockopt, socket, SOCK_STREAM, SOL_SOCKET, SO_REUSEADDR
|
||||||
#include <unistd.h> // for close
|
#include <unistd.h> // for close
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,16 @@
|
|||||||
#include "webserv/log/Log.hpp"
|
|
||||||
#include "webserv/socket/ASocket.hpp"
|
|
||||||
|
|
||||||
#include <webserv/socket/TimerSocket.hpp>
|
#include <webserv/socket/TimerSocket.hpp>
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <webserv/log/Log.hpp> // for LOCATION, Log
|
||||||
|
#include <webserv/socket/ASocket.hpp> // for ASocket
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <stdexcept> // for runtime_error
|
||||||
#include <sys/timerfd.h>
|
#include <system_error> // for generic_category, system_error
|
||||||
|
|
||||||
|
#include <errno.h> // for errno
|
||||||
|
#include <sys/time.h> // for CLOCK_MONOTONIC
|
||||||
|
#include <sys/timerfd.h> // for timerfd_create, timerfd_settime
|
||||||
|
#include <time.h> // for itimerspec, timespec
|
||||||
|
#include <unistd.h> // for read, write
|
||||||
|
|
||||||
TimerSocket::TimerSocket(std::chrono::milliseconds timeout)
|
TimerSocket::TimerSocket(std::chrono::milliseconds timeout)
|
||||||
: ASocket(timerfd_create(CLOCK_MONOTONIC, 0), ASocket::IoState::NONE), timeout_(timeout)
|
: ASocket(timerfd_create(CLOCK_MONOTONIC, 0), ASocket::IoState::NONE), timeout_(timeout)
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "webserv/socket/ASocket.hpp"
|
#include <webserv/socket/ASocket.hpp> // for ASocket
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono> // for milliseconds
|
||||||
|
|
||||||
|
#include <stddef.h> // for size_t
|
||||||
|
#include <sys/types.h> // for ssize_t
|
||||||
|
|
||||||
class TimerSocket : public ASocket
|
class TimerSocket : public ASocket
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
#include "webserv/socket/ASocket.hpp"
|
|
||||||
|
|
||||||
#include <webserv/utils/utils.hpp>
|
#include <webserv/utils/utils.hpp>
|
||||||
|
|
||||||
|
#include <webserv/socket/ASocket.hpp>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "webserv/socket/ASocket.hpp"
|
#include <webserv/socket/ASocket.hpp>
|
||||||
|
|
||||||
#include <cstddef> // for size_t
|
#include <cstddef> // for size_t
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user