moving some files and fixing includes
This commit is contained in:
parent
95753eea34
commit
010ee3e8b6
@ -1,20 +1,18 @@
|
||||
#include "webserv/router/Router.hpp"
|
||||
|
||||
#include <webserv/client/Client.hpp>
|
||||
#include <webserv/config/ConfigManager.hpp>
|
||||
#include <webserv/config/ServerConfig.hpp>
|
||||
#include <webserv/handler/ErrorHandler.hpp>
|
||||
#include <webserv/http/HttpHeaders.hpp>
|
||||
#include <webserv/log/Log.hpp>
|
||||
#include <webserv/server/Server.hpp>
|
||||
#include <webserv/socket/Socket.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <utility>
|
||||
#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/Socket.hpp> // for Socket
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <cstdint> // for uint8_t
|
||||
#include <functional> // for ref, reference_wrapper
|
||||
#include <map> // for map
|
||||
#include <string> // for basic_string, to_string, operator+, operator<=>
|
||||
#include <utility> // for pair, move
|
||||
|
||||
#include <sys/types.h> // for ssize_t
|
||||
|
||||
Client::Client(std::unique_ptr<Socket> socket, Server &server)
|
||||
: client_socket_(std::move(socket)), server_(std::ref(server)), httpRequest_(std::make_unique<HttpRequest>(this)),
|
||||
|
||||
@ -1,19 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
// #include "webserv/http/HttpResponse.hpp"
|
||||
|
||||
#include "webserv/http/HttpResponse.hpp"
|
||||
// #include <webserv/http/HttpResponse.hpp>
|
||||
|
||||
#include <webserv/config/ServerConfig.hpp> // for ServerConfig
|
||||
#include <webserv/http/HttpConstants.hpp> // for OK
|
||||
#include <webserv/http/HttpRequest.hpp> // for HttpRequest
|
||||
#include <webserv/http/HttpResponse.hpp> // for HttpResponse
|
||||
#include <webserv/server/Server.hpp>
|
||||
#include <webserv/socket/Socket.hpp>
|
||||
#include <webserv/socket/Socket.hpp> // for Socket
|
||||
|
||||
#include <cstddef> // for size_t
|
||||
#include <cstdint>
|
||||
#include <cstdint> // for uint8_t
|
||||
#include <memory> // for unique_ptr
|
||||
#include <vector>
|
||||
#include <vector> // for vector
|
||||
|
||||
class Server;
|
||||
class Socket;
|
||||
@ -39,6 +38,7 @@ class Client
|
||||
[[nodiscard]] int getStatusCode() const;
|
||||
|
||||
[[nodiscard]] Socket &getSocket() const { return *client_socket_; }
|
||||
|
||||
// void setError(int statusCode);
|
||||
|
||||
void setStatusCode(int code);
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
#include <webserv/config/AConfig.hpp> // for AConfig
|
||||
|
||||
#include <webserv/config/directive/ADirective.hpp> // for ADirective
|
||||
#include <webserv/config/directive/DirectiveFactory.hpp> // for DirectiveFactory
|
||||
#include <webserv/config/directive/DirectiveValue.hpp> // for DirectiveValue
|
||||
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
||||
#include <webserv/utils/utils.hpp> // for trim
|
||||
|
||||
#include <sstream> // for basic_stringstream, stringstream
|
||||
#include <utility> // for move, pair
|
||||
#include <utility> // for pair, move
|
||||
|
||||
AConfig::AConfig(const AConfig *parent) : parent_(parent) {}
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#include <webserv/config/directive/DirectiveValue.hpp>
|
||||
|
||||
#include <memory> // for unique_ptr
|
||||
#include <optional>
|
||||
#include <optional> // for nullopt, optional
|
||||
#include <string> // for string
|
||||
#include <vector> // for vector
|
||||
|
||||
@ -28,8 +28,7 @@ class AConfig
|
||||
[[nodiscard]] const ADirective *getDirective(const std::string &name) const;
|
||||
[[nodiscard]] std::vector<const ADirective *> getDirectives() const;
|
||||
|
||||
template <typename T>
|
||||
std::optional<T> get(const std::string &name) const
|
||||
template <typename T> std::optional<T> get(const std::string &name) const
|
||||
{
|
||||
const auto *directive = getDirective(name);
|
||||
if (!directive)
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
#include <webserv/config/ConfigManager.hpp>
|
||||
|
||||
#include <webserv/config/GlobalConfig.hpp> // for GlobalConfig
|
||||
#include <webserv/log/Log.hpp> // for Log
|
||||
#include <webserv/utils/utils.hpp> // for removeComments
|
||||
|
||||
#include <fstream> // for basic_ifstream, basic_filebuf, basic_ostream::operator<<, ifstream, stringstream
|
||||
#include <optional> // for optional
|
||||
#include <sstream> // for basic_stringstream
|
||||
#include <stdexcept> // for runtime_error
|
||||
#include <string> // for basic_string, char_traits, operator+, string, to_string, operator==, stoi
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#include <webserv/config/GlobalConfig.hpp>
|
||||
|
||||
#include <webserv/log/Log.hpp> // for Log
|
||||
#include <webserv/utils/utils.hpp> // for findCorrespondingClosingBrace
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#include <webserv/config/AConfig.hpp> // for AConfig
|
||||
#include <webserv/config/LocationConfig.hpp>
|
||||
|
||||
#include <webserv/config/AConfig.hpp> // for AConfig
|
||||
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
||||
|
||||
LocationConfig::LocationConfig(const std::string &block, const std::string &path, const AConfig *parent)
|
||||
|
||||
@ -19,6 +19,7 @@ class LocationConfig : public AConfig
|
||||
|
||||
[[nodiscard]] std::string getName() const override;
|
||||
[[nodiscard]] std::string getType() const override;
|
||||
|
||||
[[nodiscard]] const std::string &getPath() const { return _path; }
|
||||
|
||||
private:
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
#include <webserv/config/ServerConfig.hpp>
|
||||
|
||||
#include <webserv/config/AConfig.hpp> // for AConfig
|
||||
#include <webserv/config/LocationConfig.hpp> // for LocationConfig
|
||||
#include <webserv/config/ServerConfig.hpp>
|
||||
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
||||
#include <webserv/utils/utils.hpp> // for findCorrespondingClosingBrace, trim
|
||||
|
||||
#include <optional> // for optional
|
||||
#include <stdexcept> // for runtime_error
|
||||
#include <utility> // for pair
|
||||
|
||||
@ -79,4 +81,3 @@ std::vector<std::string> ServerConfig::getLocationPaths() const
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,6 @@ class ServerConfig : public AConfig
|
||||
[[nodiscard]] const LocationConfig *getLocation(const std::string &path) const;
|
||||
[[nodiscard]] std::vector<std::string> getLocationPaths() const;
|
||||
|
||||
|
||||
private:
|
||||
std::map<std::string, std::unique_ptr<LocationConfig>> locations_;
|
||||
AConfig *parent_ = nullptr;
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "webserv/config/config_validator/AValidationRule.hpp"
|
||||
#include "webserv/config/config_validator/ValidationResult.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class AConfig;
|
||||
|
||||
class AllowedValuesRule : public AValidationRule
|
||||
{
|
||||
public:
|
||||
explicit AllowedValuesRule(const std::vector<std::string> &allowedValues, bool requiresValue = true);
|
||||
|
||||
private:
|
||||
[[nodiscard]] ValidationResult validateValue(const AConfig *config, const std::string &directiveName) const override;
|
||||
std::vector<std::string> allowedValues_;
|
||||
};
|
||||
@ -1,38 +0,0 @@
|
||||
#include "webserv/config/config_validator/ConfigValidator.hpp"
|
||||
|
||||
#include "webserv/config/GlobalConfig.hpp"
|
||||
#include "webserv/config/config_validator/AllowedValuesRule.hpp"
|
||||
#include "webserv/config/config_validator/PortValidationRule.hpp"
|
||||
#include "webserv/log/Log.hpp"
|
||||
#include <string>
|
||||
|
||||
ConfigValidator::ConfigValidator(const GlobalConfig *config)
|
||||
: engine_(std::make_unique<ValidationEngine>(config))
|
||||
{
|
||||
Log::trace(LOCATION);
|
||||
|
||||
engine_->addServerRule("listen", std::make_unique<PortValidationRule>());
|
||||
engine_->addLocationRule("allowed_methods", std::make_unique<AllowedValuesRule>(std::vector<std::string>{"GET", "POST", "DELETE"}));
|
||||
engine_->validate();
|
||||
}
|
||||
|
||||
std::vector<ValidationResult> ConfigValidator::getValidationResults() const
|
||||
{
|
||||
return engine_->getValidationResults();
|
||||
}
|
||||
|
||||
std::vector<ValidationResult> ConfigValidator::getErrors() const
|
||||
{
|
||||
return engine_->getErrors();
|
||||
}
|
||||
|
||||
std::vector<ValidationResult> ConfigValidator::getWarnings() const
|
||||
{
|
||||
return engine_->getWarnings();
|
||||
}
|
||||
|
||||
bool ConfigValidator::hasErrors() const
|
||||
{
|
||||
return engine_->hasErrors();
|
||||
}
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
#include "webserv/config/config_validator/PortValidationRule.hpp"
|
||||
|
||||
#include "webserv/config/AConfig.hpp"
|
||||
#include "webserv/config/config_validator/ValidationResult.hpp"
|
||||
#include "webserv/config/directive/ADirective.hpp"
|
||||
#include "webserv/config/directive/DirectiveValue.hpp"
|
||||
#include "webserv/log/Log.hpp"
|
||||
|
||||
#include <string> // for string, basic_string, operator+, char_traits
|
||||
|
||||
PortValidationRule::PortValidationRule(bool requiresValue)
|
||||
: AValidationRule("PortValidationRule", "Validates that the port number is within the valid range (1-65535)", requiresValue)
|
||||
{
|
||||
}
|
||||
|
||||
ValidationResult PortValidationRule::validateValue(const AConfig *config, const std::string &directiveName) const
|
||||
{
|
||||
Log::trace(LOCATION);
|
||||
const ADirective *directive = config->getDirective(directiveName);
|
||||
if (!directive->getValue().holds<int>())
|
||||
{
|
||||
return ValidationResult::error("Directive '" + directive->getName() + "' does not hold an integer value");
|
||||
}
|
||||
|
||||
int port = directive->getValue().get<int>();
|
||||
if (port < 1 || port > 65535)
|
||||
{
|
||||
return ValidationResult::error("Port number " + std::to_string(port) + " is out of valid range (1-65535)");
|
||||
}
|
||||
|
||||
return ValidationResult::success();
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "webserv/config/config_validator/AValidationRule.hpp"
|
||||
#include <string>
|
||||
|
||||
class AConfig;
|
||||
class PortValidationRule : public AValidationRule
|
||||
{
|
||||
public:
|
||||
PortValidationRule(bool requiresValue = true);
|
||||
|
||||
private:
|
||||
[[nodiscard]] ValidationResult validateValue(const AConfig *config, const std::string &directiveName) const override;
|
||||
};
|
||||
@ -1,14 +0,0 @@
|
||||
#include "webserv/config/config_validator/ValidationResult.hpp"
|
||||
#include "webserv/config/config_validator/RequiredDirectiveRule.hpp"
|
||||
#include <webserv/config/config_validator/AValidationRule.hpp>
|
||||
#include <webserv/config/AConfig.hpp>
|
||||
|
||||
RequiredDirectiveRule::RequiredDirectiveRule()
|
||||
: AValidationRule("RequiredDirectiveRule", "Ensures that a required directive is present in the configuration", true)
|
||||
{
|
||||
}
|
||||
|
||||
ValidationResult RequiredDirectiveRule::validateValue(const AConfig *config, const std::string &directiveName) const
|
||||
{
|
||||
return ValidationResult::success();
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
#include <webserv/config/directive/ADirective.hpp> // for ADirective
|
||||
#include <webserv/config/directive/BoolDirective.hpp> // for IntDirective
|
||||
|
||||
#include <webserv/config/directive/ADirective.hpp> // for ADirective
|
||||
#include <webserv/config/directive/DirectiveValue.hpp> // for DirectiveValueType
|
||||
#include <webserv/utils/utils.hpp> // for trim
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#include <webserv/config/directive/BoolDirective.hpp> // for BoolDirective
|
||||
#include <webserv/config/directive/DirectiveFactory.hpp> // for DirectiveFactory
|
||||
|
||||
#include <webserv/config/directive/BoolDirective.hpp> // for BoolDirective
|
||||
#include <webserv/config/directive/IntDirective.hpp> // for IntDirective
|
||||
#include <webserv/config/directive/IntStringDirective.hpp> // for IntStringDirective
|
||||
#include <webserv/config/directive/SizeDirective.hpp> // for SizeDirective
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#include <webserv/config/directive/IntStringDirective.hpp> // for IntDirective
|
||||
|
||||
#include <webserv/config/directive/ADirective.hpp> // for ADirective
|
||||
#include <webserv/config/directive/DirectiveValue.hpp> // for DirectiveValueType
|
||||
#include <webserv/config/directive/IntStringDirective.hpp> // for IntDirective
|
||||
#include <webserv/utils/utils.hpp> // for trim
|
||||
|
||||
#include <sstream> // for basic_istringstream, basic_istream::operator>>, istringstream
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#include <webserv/config/directive/SizeDirective.hpp> // for SizeDirective
|
||||
|
||||
#include <webserv/config/directive/ADirective.hpp> // for ADirective
|
||||
#include <webserv/config/directive/DirectiveValue.hpp> // for DirectiveValueType
|
||||
#include <webserv/config/directive/SizeDirective.hpp> // for SizeDirective
|
||||
#include <webserv/utils/utils.hpp> // for trim
|
||||
|
||||
#include <algorithm> // for __transform_fn, transform
|
||||
|
||||
45
webserv/config/validation/ConfigValidator.cpp
Normal file
45
webserv/config/validation/ConfigValidator.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
#include <webserv/config/validation/ConfigValidator.hpp>
|
||||
|
||||
#include <webserv/config/validation/ValidationEngine.hpp> // for ValidationEngine
|
||||
#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/PortValidationRule.hpp> // for PortValidationRule
|
||||
#include <webserv/log/Log.hpp> // for LOCATION, Log
|
||||
|
||||
#include <string> // for basic_string, string
|
||||
|
||||
ConfigValidator::ConfigValidator(const GlobalConfig *config) : engine_(std::make_unique<ValidationEngine>(config))
|
||||
{
|
||||
Log::trace(LOCATION);
|
||||
|
||||
/*Global Directive Rules*/
|
||||
|
||||
/*Server Directive Rules*/
|
||||
engine_->addServerRule("listen", std::make_unique<PortValidationRule>());
|
||||
|
||||
/*Location Directive Rules*/
|
||||
engine_->addLocationRule("allowed_methods",
|
||||
std::make_unique<AllowedValuesRule>(std::vector<std::string>{"GET", "POST", "DELETE"}));
|
||||
|
||||
engine_->validate();
|
||||
}
|
||||
|
||||
std::vector<ValidationResult> ConfigValidator::getValidationResults() const
|
||||
{
|
||||
return engine_->getValidationResults();
|
||||
}
|
||||
|
||||
std::vector<ValidationResult> ConfigValidator::getErrors() const
|
||||
{
|
||||
return engine_->getErrors();
|
||||
}
|
||||
|
||||
std::vector<ValidationResult> ConfigValidator::getWarnings() const
|
||||
{
|
||||
return engine_->getWarnings();
|
||||
}
|
||||
|
||||
bool ConfigValidator::hasErrors() const
|
||||
{
|
||||
return engine_->hasErrors();
|
||||
}
|
||||
@ -1,9 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <webserv/config/validation/ValidationEngine.hpp> // for ValidationEngine
|
||||
#include <webserv/config/validation/ValidationResult.hpp> // for ValidationResult
|
||||
|
||||
#include <memory> // for unique_ptr
|
||||
#include <vector> // for vector
|
||||
|
||||
#include "webserv/config/config_validator/ValidationEngine.hpp"
|
||||
#include <memory>
|
||||
class GlobalConfig;
|
||||
|
||||
class ConfigValidator
|
||||
{
|
||||
public:
|
||||
@ -22,5 +26,4 @@ class ConfigValidator
|
||||
|
||||
private:
|
||||
std::unique_ptr<ValidationEngine> engine_;
|
||||
|
||||
};
|
||||
@ -1,11 +1,14 @@
|
||||
#include "webserv/config/config_validator/ValidationEngine.hpp"
|
||||
#include <webserv/config/validation/ValidationEngine.hpp>
|
||||
|
||||
#include "webserv/config/AConfig.hpp"
|
||||
#include "webserv/config/LocationConfig.hpp"
|
||||
#include "webserv/config/config_validator/AValidationRule.hpp"
|
||||
#include "webserv/config/config_validator/ValidationResult.hpp"
|
||||
#include "webserv/config/directive/ADirective.hpp"
|
||||
#include "webserv/log/Log.hpp"
|
||||
#include <webserv/config/AConfig.hpp> // for AConfig
|
||||
#include <webserv/config/GlobalConfig.hpp> // for GlobalConfig
|
||||
#include <webserv/config/LocationConfig.hpp> // for LocationConfig
|
||||
#include <webserv/config/ServerConfig.hpp> // for ServerConfig
|
||||
#include <webserv/config/validation/ValidationResult.hpp> // for ValidationResult
|
||||
#include <webserv/config/validation/directive_rules/AValidationRule.hpp> // for AValidationRule
|
||||
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
||||
|
||||
#include <utility> // for move, get
|
||||
|
||||
void ValidationEngine::addGlobalRule(const std::string &directiveName, std::unique_ptr<AValidationRule> rule)
|
||||
{
|
||||
@ -1,15 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "webserv/config/GlobalConfig.hpp"
|
||||
#include "webserv/config/config_validator/AValidationRule.hpp"
|
||||
#include "webserv/config/config_validator/ValidationResult.hpp"
|
||||
#include "webserv/config/LocationConfig.hpp"
|
||||
#include "webserv/config/ServerConfig.hpp"
|
||||
#include "webserv/config/AConfig.hpp"
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <webserv/config/AConfig.hpp>
|
||||
#include <webserv/config/GlobalConfig.hpp>
|
||||
#include <webserv/config/LocationConfig.hpp>
|
||||
#include <webserv/config/ServerConfig.hpp>
|
||||
#include <webserv/config/validation/ValidationResult.hpp> // for ValidationResult
|
||||
#include <webserv/config/validation/directive_rules/AValidationRule.hpp> // for AValidationRule
|
||||
|
||||
#include <map> // for map
|
||||
#include <memory> // for unique_ptr
|
||||
#include <string> // for basic_string, string, operator<=>
|
||||
#include <vector> // for vector
|
||||
|
||||
class AConfig;
|
||||
class GlobalConfig;
|
||||
class LocationConfig;
|
||||
class ServerConfig;
|
||||
|
||||
class ValidationEngine
|
||||
{
|
||||
@ -1,5 +1,8 @@
|
||||
#include <webserv/config/config_validator/ValidationResult.hpp>
|
||||
#include <webserv/log/Log.hpp>
|
||||
#include <webserv/config/validation/ValidationResult.hpp>
|
||||
|
||||
#include <webserv/log/Log.hpp> // for Log
|
||||
|
||||
#include <utility> // for move
|
||||
|
||||
ValidationResult::ValidationResult(Type type, std::string message) : type_(type), message_(std::move(message)) {}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
class ValidationResult
|
||||
{
|
||||
@ -25,7 +25,7 @@ class ValidationResult
|
||||
static ValidationResult warning(const std::string &message);
|
||||
|
||||
[[nodiscard]] bool isValidResult() const;
|
||||
[[nodiscard]] ValidationResult::Type getType() const ;
|
||||
[[nodiscard]] ValidationResult::Type getType() const;
|
||||
[[nodiscard]] std::string getMessage() const;
|
||||
|
||||
private:
|
||||
@ -1,8 +1,10 @@
|
||||
#include <webserv/config/AConfig.hpp>
|
||||
#include <webserv/config/config_validator/AValidationRule.hpp>
|
||||
#include <webserv/config/config_validator/ValidationResult.hpp>
|
||||
#include <webserv/config/directive/ADirective.hpp>
|
||||
#include <webserv/log/Log.hpp>
|
||||
#include <webserv/config/validation/directive_rules/AValidationRule.hpp>
|
||||
|
||||
#include <webserv/config/AConfig.hpp> // for AConfig
|
||||
#include <webserv/config/validation/ValidationResult.hpp> // for ValidationResult
|
||||
#include <webserv/log/Log.hpp> // for LOCATION, Log
|
||||
|
||||
#include <utility> // for move
|
||||
|
||||
AValidationRule::AValidationRule(std::string ruleName, std::string description, bool requiresValue)
|
||||
: ruleName_(std::move(ruleName)), description_(std::move(description)), requiresValue_(requiresValue)
|
||||
@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
#include <string> // for string, basic_string
|
||||
|
||||
class ValidationResult;
|
||||
class ADirective;
|
||||
@ -18,7 +17,8 @@ class AValidationRule
|
||||
|
||||
[[nodiscard]] ValidationResult validate(const AConfig *config, const std::string &directiveName) const;
|
||||
[[nodiscard]] bool isRequired() const;
|
||||
[[nodiscard]] virtual ValidationResult validateValue(const AConfig *config, const std::string &directiveName) const = 0;
|
||||
[[nodiscard]] virtual ValidationResult validateValue(const AConfig *config,
|
||||
const std::string &directiveName) const = 0;
|
||||
[[nodiscard]] std::string getRuleName() const;
|
||||
[[nodiscard]] std::string getDescription() const;
|
||||
|
||||
@ -1,11 +1,15 @@
|
||||
#include <webserv/config/AConfig.hpp>
|
||||
#include <webserv/config/config_validator/AllowedValuesRule.hpp>
|
||||
#include <webserv/config/config_validator/ValidationResult.hpp>
|
||||
#include <webserv/config/directive/ADirective.hpp>
|
||||
#include <webserv/config/validation/directive_rules/AllowedValuesRule.hpp>
|
||||
|
||||
#include <algorithm> // for find
|
||||
#include <webserv/config/AConfig.hpp> // for AConfig
|
||||
#include <webserv/config/directive/ADirective.hpp> // for ADirective
|
||||
#include <webserv/config/directive/DirectiveValue.hpp> // for DirectiveValue
|
||||
#include <webserv/config/validation/ValidationResult.hpp> // for ValidationResult
|
||||
#include <webserv/config/validation/directive_rules/AValidationRule.hpp> // for AValidationRule
|
||||
|
||||
#include <string> // for string, basic_string, operator+, char_traits
|
||||
#include <functional> // for identity
|
||||
#include <ranges> // for __find_fn, find
|
||||
#include <string> // for basic_string, allocator, operator+, char_traits, string, operator==
|
||||
#include <utility> // for move
|
||||
#include <vector> // for vector
|
||||
|
||||
AllowedValuesRule::AllowedValuesRule(const std::vector<std::string> &allowedValues, bool requiresValue)
|
||||
@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include <webserv/config/validation/ValidationResult.hpp>
|
||||
#include <webserv/config/validation/directive_rules/AValidationRule.hpp> // for AValidationRule
|
||||
|
||||
#include <string> // for basic_string, string
|
||||
#include <vector> // for vector
|
||||
|
||||
class AConfig;
|
||||
|
||||
class AllowedValuesRule : public AValidationRule
|
||||
{
|
||||
public:
|
||||
explicit AllowedValuesRule(const std::vector<std::string> &allowedValues, bool requiresValue = true);
|
||||
|
||||
private:
|
||||
[[nodiscard]] ValidationResult validateValue(const AConfig *config,
|
||||
const std::string &directiveName) const override;
|
||||
std::vector<std::string> allowedValues_;
|
||||
};
|
||||
@ -0,0 +1,34 @@
|
||||
#include <webserv/config/validation/directive_rules/PortValidationRule.hpp>
|
||||
|
||||
#include <webserv/config/AConfig.hpp> // for AConfig
|
||||
#include <webserv/config/directive/ADirective.hpp> // for ADirective
|
||||
#include <webserv/config/directive/DirectiveValue.hpp> // for DirectiveValue
|
||||
#include <webserv/config/validation/ValidationResult.hpp> // for ValidationResult
|
||||
#include <webserv/config/validation/directive_rules/AValidationRule.hpp> // for AValidationRule
|
||||
#include <webserv/log/Log.hpp> // for LOCATION, Log
|
||||
|
||||
#include <string> // for operator+, basic_string, allocator, char_traits, to_string, string
|
||||
|
||||
PortValidationRule::PortValidationRule(bool requiresValue)
|
||||
: AValidationRule("PortValidationRule", "Validates that the port number is within the valid range (1-65535)",
|
||||
requiresValue)
|
||||
{
|
||||
}
|
||||
|
||||
ValidationResult PortValidationRule::validateValue(const AConfig *config, const std::string &directiveName) const
|
||||
{
|
||||
Log::trace(LOCATION);
|
||||
const ADirective *directive = config->getDirective(directiveName);
|
||||
if (!directive->getValue().holds<int>())
|
||||
{
|
||||
return ValidationResult::error("Directive '" + directive->getName() + "' does not hold an integer value");
|
||||
}
|
||||
|
||||
int port = directive->getValue().get<int>();
|
||||
if (port < 1 || port > 65535)
|
||||
{
|
||||
return ValidationResult::error("Port number " + std::to_string(port) + " is out of valid range (1-65535)");
|
||||
}
|
||||
|
||||
return ValidationResult::success();
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <webserv/config/validation/directive_rules/AValidationRule.hpp> // for AValidationRule
|
||||
|
||||
#include <string> // for string
|
||||
|
||||
class AConfig;
|
||||
|
||||
class PortValidationRule : public AValidationRule
|
||||
{
|
||||
public:
|
||||
PortValidationRule(bool requiresValue = true);
|
||||
|
||||
private:
|
||||
[[nodiscard]] ValidationResult validateValue(const AConfig *config,
|
||||
const std::string &directiveName) const override;
|
||||
};
|
||||
@ -0,0 +1,15 @@
|
||||
#include <webserv/config/validation/directive_rules/RequiredDirectiveRule.hpp>
|
||||
|
||||
#include <webserv/config/validation/ValidationResult.hpp> // for ValidationResult
|
||||
#include <webserv/config/validation/directive_rules/AValidationRule.hpp> // for AValidationRule
|
||||
|
||||
RequiredDirectiveRule::RequiredDirectiveRule()
|
||||
: AValidationRule("RequiredDirectiveRule", "Ensures that a required directive is present in the configuration",
|
||||
true)
|
||||
{
|
||||
}
|
||||
|
||||
ValidationResult RequiredDirectiveRule::validateValue(const AConfig *config, const std::string &directiveName) const
|
||||
{
|
||||
return ValidationResult::success();
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "webserv/config/config_validator/AValidationRule.hpp"
|
||||
#include <webserv/config/validation/directive_rules/AValidationRule.hpp> // for AValidationRule
|
||||
|
||||
#include <string>
|
||||
#include <string> // for string
|
||||
|
||||
class AConfig;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "webserv/http/HttpResponse.hpp"
|
||||
|
||||
#include <webserv/config/AConfig.hpp>
|
||||
#include <webserv/http/HttpResponse.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
class ErrorHandler
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "webserv/http/HttpResponse.hpp"
|
||||
|
||||
#include <webserv/config/AConfig.hpp> // for AConfig
|
||||
#include <webserv/config/ConfigManager.hpp> // for ConfigManager
|
||||
#include <webserv/config/GlobalConfig.hpp> // for GlobalConfig
|
||||
#include <webserv/handler/ErrorHandler.hpp> // for ErrorHandler
|
||||
#include <webserv/http/HttpConstants.hpp> // for StatusCodeInfo, CRLF, DOUBLE_CRLF, INTERNAL_SERVER_ERROR, statusCodeInfos
|
||||
#include <webserv/http/HttpResponse.hpp>
|
||||
#include <webserv/log/Log.hpp> // for Log
|
||||
|
||||
#include <fstream> // for basic_ifstream, basic_filebuf, basic_ostream::operator<<, ifstream, stringstream
|
||||
|
||||
@ -1,20 +1,21 @@
|
||||
#include "webserv/handler/ErrorHandler.hpp"
|
||||
#include "webserv/http/HttpConstants.hpp"
|
||||
#include "webserv/http/HttpResponse.hpp"
|
||||
|
||||
#include <webserv/config/LocationConfig.hpp>
|
||||
#include <webserv/handler/FileHandler.hpp>
|
||||
#include <webserv/handler/MIMETypes.hpp>
|
||||
#include <webserv/handler/URIParser.hpp>
|
||||
#include <webserv/log/Log.hpp>
|
||||
#include <webserv/utils/FileUtils.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cerrno> // for errno
|
||||
#include <cstring> // for strerror, strlen
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <webserv/config/LocationConfig.hpp> // for LocationConfig
|
||||
#include <webserv/handler/ErrorHandler.hpp> // for ErrorHandler
|
||||
#include <webserv/handler/MIMETypes.hpp> // for MIMETypes
|
||||
#include <webserv/handler/URIParser.hpp> // for URIParser
|
||||
#include <webserv/http/HttpConstants.hpp> // for NOT_FOUND, FORBIDDEN, OK
|
||||
#include <webserv/http/HttpResponse.hpp> // for HttpResponse
|
||||
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
||||
#include <webserv/utils/FileUtils.hpp> // for joinPath, getExtension, isFile, readBinaryFile
|
||||
|
||||
#include <functional> // for identity
|
||||
#include <memory> // for unique_ptr, allocator, make_unique
|
||||
#include <optional> // for optional
|
||||
#include <ranges> // for __find_if_fn, find_if
|
||||
#include <string> // for basic_string, string, operator+, char_traits
|
||||
#include <utility> // for move
|
||||
#include <vector> // for vector
|
||||
|
||||
FileHandler::FileHandler(const LocationConfig *location, const URIParser &uriParser)
|
||||
: location_(location), uriParser_(uriParser)
|
||||
|
||||
@ -1,12 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "webserv/config/LocationConfig.hpp"
|
||||
#include "webserv/handler/URIParser.hpp"
|
||||
#include "webserv/http/HttpResponse.hpp"
|
||||
#include <webserv/config/LocationConfig.hpp>
|
||||
#include <webserv/handler/URIParser.hpp>
|
||||
#include <webserv/http/HttpResponse.hpp> // for HttpResponse
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <cstdint> // for uint8_t
|
||||
#include <memory> // for unique_ptr
|
||||
#include <string> // for string
|
||||
|
||||
class LocationConfig;
|
||||
class URIParser;
|
||||
|
||||
class FileHandler
|
||||
{
|
||||
|
||||
@ -1,25 +1,30 @@
|
||||
|
||||
#include <webserv/handler/MIMETypes.hpp>
|
||||
|
||||
#include <utility> // for pair
|
||||
|
||||
|
||||
MIMETypes::MIMETypes() {
|
||||
MIMETypes::MIMETypes()
|
||||
{
|
||||
initializeDefaults();
|
||||
}
|
||||
|
||||
std::string MIMETypes::getType(const std::string& extension) const {
|
||||
std::string MIMETypes::getType(const std::string &extension) const
|
||||
{
|
||||
auto it = mimeMap.find(extension);
|
||||
if (it != mimeMap.end()) {
|
||||
if (it != mimeMap.end())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
return "application/octet-stream"; // Default MIME type
|
||||
}
|
||||
|
||||
void MIMETypes::setType(const std::string& extension, const std::string& mimeType) {
|
||||
void MIMETypes::setType(const std::string &extension, const std::string &mimeType)
|
||||
{
|
||||
mimeMap[extension] = mimeType;
|
||||
}
|
||||
|
||||
void MIMETypes::initializeDefaults() {
|
||||
void MIMETypes::initializeDefaults()
|
||||
{
|
||||
mimeMap["html"] = "text/html";
|
||||
mimeMap["htm"] = "text/html";
|
||||
mimeMap["css"] = "text/css";
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
#ifndef MIMETYPES_HPP
|
||||
#define MIMETYPES_HPP
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
class MIMETypes {
|
||||
public:
|
||||
class MIMETypes
|
||||
{
|
||||
public:
|
||||
MIMETypes();
|
||||
|
||||
|
||||
// Returns the MIME type for a given file extension (e.g., "html" -> "text/html")
|
||||
[[nodiscard]] std::string getType(const std::string& extension) const;
|
||||
[[nodiscard]] std::string getType(const std::string &extension) const;
|
||||
|
||||
// Adds or updates a MIME type mapping
|
||||
void setType(const std::string& extension, const std::string& mimeType);
|
||||
void setType(const std::string &extension, const std::string &mimeType);
|
||||
|
||||
private:
|
||||
private:
|
||||
std::map<std::string, std::string> mimeMap;
|
||||
|
||||
void initializeDefaults();
|
||||
|
||||
@ -1,8 +1,13 @@
|
||||
#include <webserv/config/LocationConfig.hpp>
|
||||
#include <webserv/config/ServerConfig.hpp>
|
||||
#include <webserv/handler/URIParser.hpp>
|
||||
|
||||
#include <sys/stat.h> // for stat, S_ISREG, S_ISDIR
|
||||
#include <webserv/config/LocationConfig.hpp> // for LocationConfig
|
||||
#include <webserv/config/ServerConfig.hpp> // for ServerConfig
|
||||
|
||||
#include <optional> // for optional
|
||||
#include <vector> // for vector
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
#include <sys/stat.h> // for stat, S_ISDIR, S_ISREG
|
||||
|
||||
URIParser::URIParser(const std::string &uri, const ServerConfig &serverConfig) : _locationConfig(nullptr)
|
||||
{
|
||||
@ -22,7 +27,7 @@ URIParser::URIParser(const std::string &uri, const ServerConfig &serverConfig) :
|
||||
}
|
||||
|
||||
root_ = _locationConfig != nullptr ? _locationConfig->get<std::string>("root").value_or("") : "";
|
||||
if (!root_.empty() && root_.back() == '/' )
|
||||
if (!root_.empty() && root_.back() == '/')
|
||||
{
|
||||
root_.pop_back(); // Remove trailing slash to avoid double slashes in path
|
||||
}
|
||||
@ -60,7 +65,6 @@ std::string URIParser::getExtension() const
|
||||
return filename.substr(lastDot + 1);
|
||||
}
|
||||
|
||||
|
||||
LocationConfig const *URIParser::getLocation() const
|
||||
{
|
||||
return _locationConfig;
|
||||
@ -91,4 +95,3 @@ bool URIParser::isValid() const
|
||||
struct stat pathStat{};
|
||||
return stat(getFilePath().c_str(), &pathStat) == 0;
|
||||
}
|
||||
|
||||
|
||||
@ -1,21 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "webserv/config/LocationConfig.hpp"
|
||||
#include "webserv/config/ServerConfig.hpp"
|
||||
#include "webserv/server/Server.hpp"
|
||||
#include <webserv/config/LocationConfig.hpp>
|
||||
#include <webserv/config/ServerConfig.hpp>
|
||||
#include <webserv/server/Server.hpp>
|
||||
|
||||
#include <string> // for string, basic_string
|
||||
|
||||
class LocationConfig;
|
||||
class ServerConfig;
|
||||
|
||||
class URIParser
|
||||
{
|
||||
public:
|
||||
URIParser(const std::string &uri, const ServerConfig &serverConfig);
|
||||
|
||||
|
||||
[[nodiscard]] std::string getFilePath() const;
|
||||
[[nodiscard]] std::string getFilename() const;
|
||||
[[nodiscard]] std::string getExtension() const;
|
||||
|
||||
|
||||
[[nodiscard]] const LocationConfig *getLocation() const ;
|
||||
[[nodiscard]] const LocationConfig *getLocation() const;
|
||||
|
||||
[[nodiscard]] bool isFile() const;
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "HttpConstants.hpp"
|
||||
#include <webserv/http/HttpConstants.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <string_view>
|
||||
#include <array> // for array
|
||||
#include <cstdint> // for uint16_t
|
||||
#include <string> // for string
|
||||
#include <string_view> // for string_view
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
|
||||
namespace Http
|
||||
{
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#include <webserv/http/HttpConstants.hpp> // for CRLF
|
||||
#include <webserv/http/HttpHeaders.hpp> // for HttpHeaders
|
||||
|
||||
#include <webserv/http/HttpConstants.hpp> // for CRLF
|
||||
#include <webserv/log/Log.hpp>
|
||||
#include <webserv/utils/utils.hpp> // for trim
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#include <webserv/http/HttpRequest.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/log/Log.hpp> // for Log, LOCATION
|
||||
#include <webserv/utils/utils.hpp> // for stoul
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#include "webserv/http/HttpConstants.hpp"
|
||||
|
||||
#include <webserv/http/HttpResponse.hpp>
|
||||
|
||||
#include <webserv/http/HttpConstants.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "webserv/http/HttpHeaders.hpp"
|
||||
#include "webserv/log/Log.hpp"
|
||||
#include <webserv/http/HttpHeaders.hpp> // for HttpHeaders
|
||||
#include <webserv/log/Log.hpp> // for LOCATION, Log
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cstdint> // for uint8_t
|
||||
#include <memory> // for unique_ptr
|
||||
#include <string> // for string
|
||||
#include <vector> // for vector
|
||||
|
||||
class Client;
|
||||
|
||||
@ -20,7 +20,7 @@ class HttpResponse
|
||||
HttpResponse(HttpResponse &&other) noexcept = default; // Move constructor
|
||||
HttpResponse &operator=(HttpResponse &&other) noexcept = default; // Move assignment
|
||||
|
||||
~HttpResponse() {Log::trace(LOCATION);};
|
||||
~HttpResponse() { Log::trace(LOCATION); };
|
||||
|
||||
void addHeader(const std::string &key, const std::string &value);
|
||||
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
#include <webserv/config/ConfigManager.hpp> // for ConfigManager
|
||||
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
||||
#include <webserv/config/validation/ConfigValidator.hpp> // for ConfigValidator
|
||||
#include <webserv/config/validation/ValidationResult.hpp> // for ValidationResult
|
||||
#include <webserv/log/Log.hpp> // for Log
|
||||
#include <webserv/server/Server.hpp> // for Server
|
||||
#include <webserv/config/config_validator/ConfigValidator.hpp> // for ConfigValidator
|
||||
|
||||
#include <iostream> // for basic_ostream, operator<<, cerr, ios_base
|
||||
#include <string> // for basic_string, char_traits, allocator, operator+, operator<=>
|
||||
#include <iostream> // for ios_base
|
||||
#include <string> // for allocator, basic_string, char_traits, operator+, string
|
||||
#include <vector> // for vector
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
@ -1,16 +1,18 @@
|
||||
#include "webserv/config/AConfig.hpp"
|
||||
#include "webserv/config/ConfigManager.hpp"
|
||||
#include "webserv/config/ServerConfig.hpp"
|
||||
#include "webserv/handler/ErrorHandler.hpp"
|
||||
#include "webserv/handler/FileHandler.hpp"
|
||||
#include "webserv/handler/URIParser.hpp"
|
||||
#include "webserv/http/HttpResponse.hpp"
|
||||
#include "webserv/log/Log.hpp"
|
||||
|
||||
#include <webserv/router/Router.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <webserv/config/ConfigManager.hpp> // for ConfigManager
|
||||
#include <webserv/config/ServerConfig.hpp> // for ServerConfig
|
||||
#include <webserv/handler/ErrorHandler.hpp> // for ErrorHandler
|
||||
#include <webserv/handler/FileHandler.hpp> // for FileHandler
|
||||
#include <webserv/handler/URIParser.hpp> // for URIParser
|
||||
#include <webserv/http/HttpHeaders.hpp> // for HttpHeaders
|
||||
#include <webserv/log/Log.hpp> // for LOCATION, Log
|
||||
|
||||
#include <memory> // for unique_ptr
|
||||
#include <optional> // for optional
|
||||
#include <string> // for basic_string, string
|
||||
|
||||
class LocationConfig;
|
||||
|
||||
Router::Router() {}
|
||||
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "webserv/config/LocationConfig.hpp"
|
||||
#include <webserv/config/LocationConfig.hpp>
|
||||
#include <webserv/http/HttpRequest.hpp> // for HttpRequest
|
||||
#include <webserv/http/HttpResponse.hpp> // for HttpResponse
|
||||
|
||||
#include <webserv/http/HttpRequest.hpp>
|
||||
#include <webserv/http/HttpResponse.hpp>
|
||||
#include <memory> // for unique_ptr
|
||||
#include <string> // for string
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
class LocationConfig;
|
||||
class ServerConfig;
|
||||
|
||||
class Router
|
||||
{
|
||||
|
||||
@ -1,17 +1,19 @@
|
||||
#include <webserv/server/Server.hpp>
|
||||
|
||||
#include <webserv/client/Client.hpp> // for Client
|
||||
#include <webserv/config/ConfigManager.hpp> // for ConfigManager
|
||||
#include <webserv/config/ServerConfig.hpp> // for ServerConfig
|
||||
#include <webserv/log/Log.hpp> // for Log
|
||||
#include <webserv/server/Server.hpp>
|
||||
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
||||
#include <webserv/socket/Socket.hpp> // for Socket
|
||||
|
||||
#include <cerrno> // for errno
|
||||
#include <cstring> // for strerror, strlen
|
||||
#include <cstring> // for strerror
|
||||
#include <exception> // for exception
|
||||
#include <memory> // for unique_ptr, allocator, make_unique
|
||||
#include <optional> // for optional
|
||||
#include <stdexcept> // for runtime_error
|
||||
#include <string> // for basic_string, operator+, to_string, char_traits, string
|
||||
#include <unordered_map> // for unordered_map, unordered_map<>::container_type
|
||||
#include <unordered_map> // for unordered_map, operator==
|
||||
#include <utility> // for move, pair
|
||||
#include <vector> // for vector
|
||||
|
||||
@ -20,6 +22,8 @@
|
||||
#include <sys/types.h> // for ssize_t
|
||||
#include <unistd.h> // for close
|
||||
|
||||
class Router;
|
||||
|
||||
Server::Server(const ConfigManager &configManager)
|
||||
: epoll_fd_(epoll_create1(0)), configManager_(configManager), router_()
|
||||
{
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "webserv/router/Router.hpp"
|
||||
|
||||
#include <webserv/client/Client.hpp>
|
||||
#include <webserv/config/ConfigManager.hpp>
|
||||
#include <webserv/config/ServerConfig.hpp> // for ServerConfig
|
||||
#include <webserv/router/Router.hpp> // for Router
|
||||
#include <webserv/socket/Socket.hpp> // for Socket
|
||||
|
||||
#include <cstdint> // for uint32_t
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
#include "webserv/log/Log.hpp"
|
||||
|
||||
#include <webserv/utils/FileUtils.hpp>
|
||||
|
||||
#include <cstring> // for strlen
|
||||
#include <fstream>
|
||||
#include <string> // for string
|
||||
#include <webserv/log/Log.hpp> // for Log, LOCATION
|
||||
|
||||
#include <sys/stat.h> // for stat, S_ISREG, S_ISDIR
|
||||
#include <cstring> // for size_t
|
||||
#include <fstream> // for basic_ifstream, basic_ios, basic_istream, ios, ifstream, operator|, basic_istream::read, basic_istream::seekg, basic_istream::tellg, streamsize
|
||||
#include <iterator> // for istreambuf_iterator, operator==
|
||||
#include <string> // for basic_string, string, char_traits, operator+
|
||||
|
||||
#include <sys/stat.h> // for stat, S_ISDIR, S_ISREG
|
||||
|
||||
namespace FileUtils
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user