From 7e9d78a2d2b0508dad4aeef0f2150d7ead189fc0 Mon Sep 17 00:00:00 2001 From: alecmalloc Date: Wed, 16 Apr 2025 11:09:12 +0200 Subject: [PATCH] added a hosts file that we can use on macbooks for instance to show evaluator if rhey really want --- conf/diff_hosts.conf | 75 ++++++++++++++++++++++++++++++++ error_page/50x.html | 15 ------- src/Response/Session.cpp | 1 - src/Response/delete_Response.cpp | 1 - 4 files changed, 75 insertions(+), 17 deletions(-) create mode 100644 conf/diff_hosts.conf delete mode 100644 error_page/50x.html diff --git a/conf/diff_hosts.conf b/conf/diff_hosts.conf new file mode 100644 index 0000000..2bb7f59 --- /dev/null +++ b/conf/diff_hosts.conf @@ -0,0 +1,75 @@ +server { + listen 0.0.0.0:8080; + server_name mytest.local; + root ./; + autoindex on; + client_max_body_size 1m; + index assets/index.html; + use_chunked_encoding true; + chunk_size 100; + +# Custom error pages + error_page 404 /error_page/404.html; + error_page 403 /error_page/403.html; + error_page 500 /error_page/500.html; + +# Main site and directory listing test + location /assets/ { + root ./; + index old_index.html; + allowed_methods GET; + autoindex on; + } + + location /cgi-bin/ { + root ./; + allowed_methods GET POST; + cgi_path /usr/bin/python3 /usr/bin/php; + cgi_ext .py .php; + autoindex off; + } + + location /uploads/ { + root ./; + allowed_methods POST GET DELETE; + } + +} + +server { + listen 0.0.0.0:8081; + server_name mytest2.local; + root ./; + autoindex on; + client_max_body_size 1m; + index assets/index.html; + use_chunked_encoding true; + chunk_size 100; + +# Custom error pages + error_page 404 /error_page/404.html; + error_page 403 /error_page/403.html; + error_page 500 /error_page/500.html; + +# Main site and directory listing test + location /assets/ { + root ./; + index old_index.html; + allowed_methods GET; + autoindex on; + } + + location /cgi-bin/ { + root ./; + allowed_methods GET POST; + cgi_path /usr/bin/python3 /usr/bin/php; + cgi_ext .py .php; + autoindex off; + } + + location /uploads/ { + root ./; + allowed_methods POST GET DELETE; + } + +} \ No newline at end of file diff --git a/error_page/50x.html b/error_page/50x.html deleted file mode 100644 index 25b4b16..0000000 --- a/error_page/50x.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - 50x - - - -
-

50x Something Wrong ...

-
-
-
nginy/1.0
- - - \ No newline at end of file diff --git a/src/Response/Session.cpp b/src/Response/Session.cpp index f26ad24..93aa2f6 100644 --- a/src/Response/Session.cpp +++ b/src/Response/Session.cpp @@ -79,7 +79,6 @@ std::string generateSessionID(std::size_t length = 32) { return sessionID; } - // add cookie to headers (headers are generated with the ones we have so changing headers in request effectively changes them in response too) // not renaming but it also creates session void Response::createSession( void ) { diff --git a/src/Response/delete_Response.cpp b/src/Response/delete_Response.cpp index 6cf36fb..f325c1a 100644 --- a/src/Response/delete_Response.cpp +++ b/src/Response/delete_Response.cpp @@ -1,6 +1,5 @@ #include "webserv.hpp" - void Response::HandleDeleteRequest(HttpRequest& ReqObj, PathInfo& pathInfo){ // Check if DELETE method is allowed (void)ReqObj;