diff --git a/config/default.conf b/config/default.conf
index 3b72c66..a4dbcec 100644
--- a/config/default.conf
+++ b/config/default.conf
@@ -117,7 +117,7 @@ server {
listen 8083;
host 127.0.0.1;
server_name localhost;
-
+ client_max_body_size 1000m;
root ./htdocs/YoupiBanane/;
index index.html index2.htm;
@@ -134,7 +134,7 @@ server {
location /post_body {
root ./htdocs/YoupiBanane/;
- client_max_body_size 100;
+ client_max_body_size 1000m;
allowed_methods POST;
}
diff --git a/htdocs/YoupiBanane/index.html b/htdocs/YoupiBanane/index.html
new file mode 100644
index 0000000..c355a00
--- /dev/null
+++ b/htdocs/YoupiBanane/index.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+ YoupiBanane
+
+
+ Welcome to YoupiBanane!
+ This is the index page.
+
+
\ No newline at end of file
diff --git a/htdocs/YoupiBanane/nop/youpi.pouic b/htdocs/YoupiBanane/nop/other.pouic
similarity index 100%
rename from htdocs/YoupiBanane/nop/youpi.pouic
rename to htdocs/YoupiBanane/nop/other.pouic
diff --git a/webserv/handler/FileHandler.cpp b/webserv/handler/FileHandler.cpp
index 6b07daf..ee3a1da 100644
--- a/webserv/handler/FileHandler.cpp
+++ b/webserv/handler/FileHandler.cpp
@@ -39,11 +39,12 @@ void FileHandler::handleFile(const std::string &filepath) const
std::vector fileData = FileUtils::readBinaryFile(filepath);
Log::debug("Serving file: " + filepath + " with MIME type: " + mimeType);
- if (fileData.empty())
- {
- ErrorHandler::createErrorResponse(Http::StatusCode::NOT_FOUND, response_, config_);
- return;
- }
+ // TODO empty file should not return 404 i guess
+ // if (fileData.empty())
+ // {
+ // ErrorHandler::createErrorResponse(Http::StatusCode::NOT_FOUND, response_, config_);
+ // return;
+ // }
// TODO: annoying: For reading files, vector is preferred, but for http data vector is preferred
response_.setBody(std::vector{fileData.begin(), fileData.end()});
response_.setStatus(Http::StatusCode::OK);
@@ -62,7 +63,7 @@ void FileHandler::handleDirectory(const std::string &dirpath, ResourceType type)
});
if (first_matching == possible_indexes.end())
{
- ErrorHandler::createErrorResponse(Http::StatusCode::FORBIDDEN, response_, config_);
+ ErrorHandler::createErrorResponse(Http::StatusCode::NOT_FOUND, response_, config_);
return;
}
handleFile(FileUtils::joinPath(dirpath, *first_matching));
diff --git a/webserv/log/Log.cpp b/webserv/log/Log.cpp
index af12486..fce55e3 100644
--- a/webserv/log/Log.cpp
+++ b/webserv/log/Log.cpp
@@ -196,9 +196,10 @@ void Log::status(const std::string &message)
_statusActive = true;
// Save cursor position, move to bottom, clear line, print status, restore cursor
- std::cout << "\033[s" // Save cursor position
- << "\033[999;0H" // Move to bottom row
- << "\033[2K" // Clear entire line
+ std::cout << "\033[s" // Save cursor position
+ << "\033[999;0H" // Move to bottom row
+ << "\033[2K" // Clear entire line
+ << "\033[34m" // Set text color to blue
<< "\033[7m" // Reverse video (inverted colors)
<< message << "\033[0m" // Reset formatting
<< "\033[u" // Restore cursor position
diff --git a/webserv/server/Server.cpp b/webserv/server/Server.cpp
index f8f8be1..59c231b 100644
--- a/webserv/server/Server.cpp
+++ b/webserv/server/Server.cpp
@@ -1,9 +1,8 @@
-#include
-
#include // for Client
#include // for ConfigManager
#include // for ServerConfig
#include // for Log, LOCATION
+#include
#include // for ASocket
#include // for ClientSocket
#include // for ServerSocket
@@ -27,7 +26,7 @@
#include // for SOMAXCONN
#include // for close
-volatile sig_atomic_t Server::stop_ = 0;
+volatile sig_atomic_t Server::signum_ = 0;
Server::Server(const ConfigManager &configManager) : epoll_fd_(epoll_create1(O_CLOEXEC)), configManager_(configManager)
{
@@ -308,12 +307,12 @@ void Server::run()
{
Log::trace(LOCATION);
Log::info("Listening...");
- const int MAX_EVENTS = 10;
+ const int MAX_EVENTS = 1024;
struct epoll_event events[MAX_EVENTS]; // NOLINT
- while (stop_ == 0)
+ while (signum_ == 0)
{
std::string status = "Active connections: " + std::to_string(clients_.size());
- Log::status(status);
+ Log::status(status);
pollSockets();
pollClients();
handleEpoll(events, MAX_EVENTS); // NOLINT (cppcoreguidelines-pro-bounds-pointer-arithmetic)
@@ -323,9 +322,8 @@ void Server::run()
void Server::signalHandler(int signum)
{
-
if (signum == SIGINT)
{
- stop_ = signum;
+ signum_ = signum;
}
}
\ No newline at end of file
diff --git a/webserv/server/Server.hpp b/webserv/server/Server.hpp
index 44f6899..ade60c0 100644
--- a/webserv/server/Server.hpp
+++ b/webserv/server/Server.hpp
@@ -46,7 +46,7 @@ class Server
private:
int epoll_fd_;
- static volatile sig_atomic_t stop_;
+ static volatile sig_atomic_t signum_;
const ConfigManager &configManager_;
std::vector> listeners_;
std::set listener_fds_;