diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 81e8606..15747ad 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -24,5 +24,4 @@ jobs:
- name: Run make
run: make
- - name: Run tests
- run: make tests
+
diff --git a/.gitignore b/.gitignore
index b7b66b0..d561c02 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,31 +1,41 @@
# Prerequisites
*.d
+labs/myfld/*
-
-
-
+test/runner
labs/intern/
-
+ts.txt
# Compiled Object files
*.slo
*.lo
*.o
*.obj
*.p
+*.mp4
+
./configs/php/app
configs/php/app
# Precompiled Headers
*.gch
*.pch
labs/app
+mmm/
+var/tmp/*
+var/www/html/main/uploads/*
*.log
+ts.html
+otm.cpp
+*.otm
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
-
+*.zip
+uploadtestfile.txt
+uploadtestfile.cpp
+.DS_Store
# Fortran module files
*.mod
*.smod
@@ -44,3 +54,7 @@ testing/
*.exe
*.out
*.app
+.DS_Store
+
+
+test*
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 7cb8a0c..a69225b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,25 +1,23 @@
CPP = c++
-CPPFLAGS = -Wall -Wextra -Werror -std=c++98 -I./headers/ #-fsanitize=address
+CPPFLAGS = -Wall -Wextra -Werror -std=c++98 -I./headers/
NAME=webserv
-# OTM
SRCS=main.cpp srcs/parsing/config/readConfig.cpp srcs/parsing/helpers/strTrim.cpp \
-srcs/parsing/helpers/FtPars.cpp srcs/models/Server.cpp debug/printing.cpp
+srcs/parsing/helpers/FtPars.cpp srcs/models/Server.cpp \
+srcs/utils/httpResponseErrors.cpp srcs/utils/serverUtils.cpp srcs/utils/ClientData.cpp \
-# ACHAKKAF
-SRCS += srcs/cgi/ft_cgi.cpp
+SRCS += srcs/models/Upload.cpp srcs/models/Request.cpp
-# MOAD
-SRCS +=
+SRCS += srcs/models/Response.cpp srcs/models/ResponseUtils.cpp srcs/models/MimeTypes.cpp srcs/models/Cgi.cpp
-#OTM
SRCS += srcs/models/Webserv.cpp srcs/models/WebservHandler.cpp
HEADERS=headers/*.hpp
OBJS=$(SRCS:.cpp=.o)
all: $(NAME)
+ mkdir -p ./var/tmp
$(NAME): $(OBJS)
$(CPP) $(CPPFLAGS) $(OBJS) -o $(NAME)
@@ -32,8 +30,7 @@ clean:
fclean: clean
rm -f $(NAME)
-tests:
- bash test/test01.sh
+
re: fclean all
diff --git a/configs/500.html b/configs/500.html
deleted file mode 100644
index c17bc68..0000000
--- a/configs/500.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
- 500 | Server Error
-
-
-
- 500 | Server Error
-
-
-
\ No newline at end of file
diff --git a/configs/config.conf b/configs/config.conf
index 6b797af..8f88e04 100644
--- a/configs/config.conf
+++ b/configs/config.conf
@@ -2,31 +2,31 @@
# Server 1: Default server
###############################################################################
[server.default]
+# required
host = "127.0.0.1"
-port = "8080,5555"
+# required
+port = "8080,7070"
+# optional
server_name = "myserver.local"
-client_max_body_size = "1048576"
-
-# Default error pages
-error_page_404 = "/errors/404.html"
-error_page_500 = "/errors/500.html"
-
-# Route 1 (for path "/")
-# location_path = "/" //!
-location_root = "/var/www/html"
-# location_redirect = "/xyz/index.html"
+# optional
+client_max_body_size = "40000000000"
+# Timeouts IN SECONDS
+# optional
+client_timeout = "555"
+# optional
+# redirects = "/index.html:/page.html"
+# optional
+client_body_temp_path= "var/tmp"
+
+# location_root required
+location_root = "var/www/html/main"
+# required
indexes = "index.html,index.php,index.py"
allowed_methods = "POST,DELETE,GET"
-autoindex = "off"
-# upload_enabled = "on"
-upload_store = "/var/www/uploads"
-
-
-# Route 3 (for path "/scripts")
-location3_path = "./scripts/php/"
-location3_root = "/var/www/cgi-bin"
-location3_cgi_enable = ".php,.py"
-location3_cgi_path_info = "on"
+autoindex = "on"
+upload_enabled = "on"
+upload_store = "var/www/html/main/uploads/"
+cgi = "/bin/bash:.sh"
###############################################################################
@@ -34,59 +34,19 @@ location3_cgi_path_info = "on"
###############################################################################
[server.second]
host = "127.0.0.1"
-port = "9090"
-server_name = "another-server.local"
-
-# Error page for this server
-error_page_403 = "/errors/403.html"
-
-# Route (for path "/static")
-location1_path = "/static"
-location1_root = "/var/www/static"
-allowed_methods = "GET"
-autoindex = "on"
+port = "9000"
+server_name = "second.local"
+location_root = "var/www/html/magic"
+indexes = "index.html,index.php,index.py"
###############################################################################
# Server 3
###############################################################################
[server.third]
-host = "192.168.1.1"
-port = "8081"
-server_name = "third-server.local"
-client_max_body_size = "2097152"
-
-# Error pages
-error_page_400 = "/errors/400.html"
-error_page_500 = "/errors/500.html"
-
-# Route (for path "/")
-location1_path = "/"
-location1_root = "/var/www/app"
-indexes = "home.html"
-allowed_methods = "GET,POST"
-autoindex = "off"
-location1_upload_enabled = "off"
-
-
-###############################################################################
-# Server 4
-###############################################################################
-[server.fourth]
-host = "10.0.0.1"
-port = "4444,7070"
-server_name = "fourth-server.local"
-client_max_body_size = "5242880"
-
-# Error pages
-error_page_403 = "/errors/403.html"
-error_page_502 = "/errors/502.html"
+host = "0.0.0.0"
+port = "9999"
+server_name = "second.local"
+location_root = "var/www/html/simple"
+indexes = "index.html,index.php,index.py"
-# Route (for path "/")
-location1_path = "/"
-location1_root = "/var/www/public"
-indexes = "default.html"
-allowed_methods = "GET,POST,DELETE"
-autoindex = "on"
-location1_upload_enabled = "on"
-location1_upload_store = "/var/www/public/uploads"
diff --git a/configs/php/Makefile b/configs/php/Makefile
deleted file mode 100644
index ab6e35b..0000000
--- a/configs/php/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-all:
- c++ app.cpp -std=c++98 -o app && clear && ./app
\ No newline at end of file
diff --git a/configs/php/app.cpp b/configs/php/app.cpp
deleted file mode 100644
index aa0f447..0000000
--- a/configs/php/app.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/* ************************************************************************** */
-/* */
-/* ::: :::::::: */
-/* app.cpp :+: :+: :+: */
-/* +:+ +:+ +:+ */
-/* By: ochouati +#+ +:+ +#+ */
-/* +#+#+#+#+#+ +#+ */
-/* Created: 2025/03/09 01:13:52 by ochouati #+# #+# */
-/* Updated: 2025/03/11 14:53:35 by ochouati ### ########.fr */
-/* */
-/* ************************************************************************** */
-
-#include
-#include
-#include
-#include
-#include
-#include // For waitpid
-#include // For strdup
-
-int main(int ac, char **av, char **env) {
- std::vector envs;
- // std::vector args;
-
- // Copy existing environment variables
- for (int i = 0; env[i]; i++) {
- envs.push_back(env[i]);
- }
-
- // Add PHP specific environment variables to simulate $_GET
- envs.push_back(strdup("PHP_VALUE=variables_order=EGPCS"));
- envs.push_back(strdup("REQUEST_METHOD=GET"));
-
- // We're going to pass the NAME parameter directly as an argument
- // This will make it available through argv in PHP
-
- // Null terminator for environment array
- envs.push_back(NULL);
-
- int pid = fork();
- char *path = "/usr/bin/php";
-
- // Pass the GET parameter as an argument
- char *args[] = {"php", "-d", "register_argc_argv=1", "-d", "auto_globals_jit=0",
- "-r", "parse_str('NAME=achakkaf', $_GET); include('index.php');", NULL};
- // args.push_back("php");
- if (pid == 0) {
- execve(path, args, envs.data());
- // If execve returns, it failed
- perror("execve failed");
- exit(1);
- } else {
- waitpid(pid, NULL, 0);
- }
-
- // Free allocated memory
- for (size_t i = 0; i < envs.size() - 1; i++) {
- if (strncmp(envs[i], "PHP_VALUE=", 10) == 0 ||
- strncmp(envs[i], "REQUEST_METHOD=", 15) == 0) {
- free(envs[i]);
- }
- }
-
- return 0;
-}
\ No newline at end of file
diff --git a/configs/php/index.php b/configs/php/index.php
deleted file mode 100644
index b3465fb..0000000
--- a/configs/php/index.php
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
Hi, $name";
- echo "
Hi, $age";
- ?>
-
-
-
\ No newline at end of file
diff --git a/configs/py/index.py b/configs/py/index.py
deleted file mode 100644
index e69de29..0000000
diff --git a/debug/printing.cpp b/debug/printing.cpp
deleted file mode 100644
index 708c6ee..0000000
--- a/debug/printing.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/* ************************************************************************** */
-/* */
-/* ::: :::::::: */
-/* printing.cpp :+: :+: :+: */
-/* +:+ +:+ +:+ */
-/* By: ochouati +#+ +:+ +#+ */
-/* +#+#+#+#+#+ +#+ */
-/* Created: 2025/02/18 09:28:54 by ochouati #+# #+# */
-/* Updated: 2025/03/01 17:31:25 by ochouati ### ########.fr */
-/* */
-/* ************************************************************************** */
-
-#include
-#include