diff --git a/cgi-bin/name.pl b/cgi-bin/name.pl new file mode 100755 index 0000000..e56bec1 --- /dev/null +++ b/cgi-bin/name.pl @@ -0,0 +1,33 @@ +#!/usr/bin/perl +use strict; +use warnings; +use CGI; + +# Create CGI object +my $cgi = CGI->new; + +# Print the HTTP header +print $cgi->header('text/html'); + +# Get the name parameter from the form +my $name = $cgi->param('name'); + +# Print the HTML content +print < + + Hello CGI Test + + + +

Hello, $name!

+

Welcome to the WebServ CGI Perl Test Suite. Your name has been received and displayed successfully.

+

Go back to the Test Suite

+ + +EOF + diff --git a/cgi-bin/test.pl b/cgi-bin/test.pl new file mode 100755 index 0000000..2847b8a --- /dev/null +++ b/cgi-bin/test.pl @@ -0,0 +1,4 @@ +#!/usr/bin/perl +print "Content-type: text/html\n\n"; +print "

Hello from Perl CGI

"; + diff --git a/cgi-bin/uploads/Makefile b/cgi-bin/uploads/Makefile new file mode 100644 index 0000000..e8a3e3b --- /dev/null +++ b/cgi-bin/uploads/Makefile @@ -0,0 +1,67 @@ +NAME ?= fractol + +BUILD_DIR ?= ./obj +SRC_DIRS ?= ./src +BONUS_DIRS ?= ./src/bonus + +LIB = libft +LIBS = $(addprefix -L ,$(LIB)) + +SRCS := $(shell find $(SRC_DIRS) -name *.c) +BONUS_SRCS := $(shell find $(BONUS_DIRS) -name *.c) + +OBJS := $(subst $(SRC_DIRS), $(BUILD_DIR), $(SRCS:.c=.o)) +BONUS_OBJS := $(subst $(BONUS_DIRS), $(BUILD_DIR), $(BONUS_SRCS:.c=.o)) + +DEPS := $(OBJS:.o=.d) +BONUS_DEPS := $(BONUS_OBJS:.o=.d) + +INC_DIRS := $(shell find $(SRC_DIRS) -type d) +INC_FLAGS := $(addprefix -I,$(INC_DIRS)) + +CC = cc +CFLAGS ?= $(INC_FLAGS) -Wall -Werror -Wextra -MMD -MP + +LD = cc +LDFLAGS = $(LIBS) +LINKS = -lft -lmlx -lXext -lX11 -lm + +HIDE = @ + +all: $(NAME) + +$(NAME): $(OBJS) + @make -C $(LIB) + @echo "\nLinking:" + $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LINKS) + @echo "..\n" + +$(BUILD_DIR)/%.o: $(SRC_DIRS)/%.c + $(HIDE) mkdir -p $(@D) + $(HIDE) $(CC) $(CFLAGS) -c $< -o $@ + @echo "Compiling $< ..\n" + +bonus: $(BONUS_OBJS) + @make -C $(LIB) + @echo "\nLinking:" + $(LD) $(LDFLAGS) -o $(NAME) $(OBJS) $(LINKS) + @echo "..\n" + +$(BUILD_DIR)/%.o: $(BONUS_DIRS)/%.c + $(HIDE) mkdir -p $(@D) + $(HIDE) $(CC) $(CFLAGS) -c $< -o $@ + @echo "Compiling $< ..\n" + +.PHONY: clean fclean re debug + +clean: + $(HIDE) $(RM) -r $(BUILD_DIR) + @echo "removing obj/ ..\n" + +fclean: clean + $(HIDE) $(RM) $(NAME) + @echo "removing $(NAME) ..\n" + +re: fclean all + +-include $(DEPS) diff --git a/cgi-bin/uploads/en.subject.pdf b/cgi-bin/uploads/en.subject.pdf deleted file mode 100644 index aa6f72d..0000000 Binary files a/cgi-bin/uploads/en.subject.pdf and /dev/null differ diff --git a/cgi-bin/uploads/libstdc++.a b/cgi-bin/uploads/libstdc++.a deleted file mode 100644 index d66163b..0000000 Binary files a/cgi-bin/uploads/libstdc++.a and /dev/null differ diff --git a/cgi-bin/uploads/responseCodes.md b/cgi-bin/uploads/responseCodes.md deleted file mode 100644 index 1678eb2..0000000 --- a/cgi-bin/uploads/responseCodes.md +++ /dev/null @@ -1,30 +0,0 @@ -# HTTP Response Codes - -## 1xx: Informational -- **100 Continue**: The server has received the request headers, and the client should proceed to send the request body. -- **101 Switching Protocols**: The requester has asked the server to switch protocols and the server has agreed to do so. - -## 2xx: Success -- **200 OK**: The request was successful. -- **201 Created**: The request was successful and a new resource was created. -- **202 Accepted**: The request has been accepted for processing, but the processing has not been completed. -- **204 No Content**: The server successfully processed the request, but is not returning any content. - -## 3xx: Redirection -- **301 Moved Permanently**: The requested resource has been assigned a new permanent URI. -- **302 Found**: The requested resource resides temporarily under a different URI. -- **304 Not Modified**: The resource has not been modified since the version specified by the request headers. - -## 4xx: Client Error -- **400 Bad Request**: The server could not understand the request due to invalid syntax. -- **401 Unauthorized**: The client must authenticate itself to get the requested response. -- **403 Forbidden**: The client does not have access rights to the content. -- **404 Not Found**: The server can not find the requested resource. -- **405 Method Not Allowed**: The request method is known by the server but is not supported by the target resource. - -## 5xx: Server Error -- **500 Internal Server Error**: The server has encountered a situation it doesn't know how to handle. -- **501 Not Implemented**: The request method is not supported by the server and cannot be handled. -- **502 Bad Gateway**: The server, while acting as a gateway or proxy, received an invalid response from the upstream server. -- **503 Service Unavailable**: The server is not ready to handle the request. -- **505 Wrong HTTP Version** diff --git a/cgi-bin/uploads/test b/cgi-bin/uploads/test deleted file mode 100644 index ce01362..0000000 --- a/cgi-bin/uploads/test +++ /dev/null @@ -1 +0,0 @@ -hello diff --git a/cgi-bin/uploads/test.pdf b/cgi-bin/uploads/test.pdf deleted file mode 100644 index 2b30406..0000000 Binary files a/cgi-bin/uploads/test.pdf and /dev/null differ diff --git a/cgi-bin/uploads/tester.conf b/cgi-bin/uploads/tester.conf deleted file mode 100644 index 3929a27..0000000 --- a/cgi-bin/uploads/tester.conf +++ /dev/null @@ -1,38 +0,0 @@ -server { - listen 8080; - server_name localhost; - - # Root directory for the server - root ./; - - # Default error pages - error_page 404 /error_pages/404.html; - error_page 403 /error_pages/403.html; - error_page 500 /error_pages/500.html; - - # / must answer to GET request ONLY - location / { - allowed_methods GET; - } - - # /post_body must answer to POST with maxBody of 100 - location /post_body { - allowed_methods POST; - - } - - # /directory/ uses YoupiBanane as root and defaults to youpi.bad_extension - location / { - allowed_methods GET; - root ./YoupiBanane; - index youpi.bad_extension; - autoindex on; - } - - # For .bla files - change to location that contains those files - location /YoupiBanane { - allowed_methods POST GET; - cgi_path ./cgi_test; - cgi_ext .bla; - } -} \ No newline at end of file diff --git a/conf/default.conf b/conf/default.conf index 74339b1..9decba5 100644 --- a/conf/default.conf +++ b/conf/default.conf @@ -4,7 +4,7 @@ server { root ./; autoindex on; client_max_body_size 1m; - index assets/index.html; + index html/index.html; use_chunked_encoding true; chunk_size 100; @@ -24,8 +24,8 @@ server { location /cgi-bin/ { root ./; allowed_methods GET POST; - cgi_path /usr/bin/python3 /usr/bin/php; - cgi_ext .py .php; + cgi_path /usr/bin/python3 /usr/bin/perl; + cgi_ext .py .pl; autoindex off; upload_dir uploads; } diff --git a/html/index.html b/html/index.html index f5cda21..fa701ef 100755 --- a/html/index.html +++ b/html/index.html @@ -1,408 +1,491 @@ - - - - WebServ Test Suite - - - -
-
-

WebServ Test Suite

-

Comprehensive test suite for our C++98 HTTP server implementation

-
- - -
-

- Basic HTTP Methods -

-
Test basic HTTP method functionality
- + + + + WebServ Test Suite + + + +
+
+

WebServ Test Suite

+

Comprehensive test suite for our C++98 HTTP server implementation

+
+ +

- File Type Tests - GET + Basic HTTP Methods

-
Test server's handling of different file types and MIME types
- -

Images

-
- JPEG Image - PNG Image - GIF Image - WebServer Logo +
Test basic HTTP method functionality
+ +
+

+ File Type Tests + GET +

+
Test server's handling of different file types and MIME types
+ +

Images

+ + +

Documents

+ + +

Data Files

+ + +

Special Files

+
+ Favicon +
- -

Documents

-
- Plain Text + + +

POST Method Test

+
+
+ + +
+ +
+ + +

DELETE Method Test

+
+ +
- -

Data Files

+ +
+ + +
+

+ Cookies Tests + Cookies +

+
Test cookies functionality
- -

Special Files

+
+ + +
+

+ File Upload Tests + POST +

+
Test file upload functionality
+ +
+
+ + +
+ +
+ +

Upload Large File Test

+
Test uploading a larger file (if your server has a size limit)
+
+
+ + +
+ +
+
+ + + +
+

+ Directory & Static Content Tests + GET +

+
Test directory listing, index files, and static content
+ +

Directory Tests

+
- - -

POST Method Test

-
-
- - -
- -
- - -

DELETE Method Test

-
- - -
- -
- - -
-

- Cookies Tests - Cookies -

-
Test cookies functionality
- -
- - -
-

- File Upload Tests - POST -

-
Test file upload functionality
- -
-
- - -
- -
- -

Upload Large File Test

-
Test uploading a larger file (if your server has a size limit)
-
-
- - -
- -
-
- - -
-

CGI Tests

-
Test CGI script execution in different languages
- - -

Trigger inifnit CGI Script

-
- -
- - -

Python CGI Tests

-
-
- - -
- -
- - -

CGI with GET Parameters

-
-
- - -
-
- - -
- -
- -
Or test with direct URL parameters:
- Test GET with URL Parameters - - -

CGI File Upload Test

-
-
- - -
-
- - -
- -
-
- - - -
- - - + + +
+

CGI Tests

+
Test CGI script execution in different languages
+ +

Python CGI

+ + +

Trigger inifnit CGI Script

+
+ +
+ + +

Python CGI Tests

+
+
+ + +
+ +
+ + +

CGI with GET Parameters

+
+
+ + +
+
+ + +
+ +
+ +
Or test with direct URL parameters:
+ Test GET with URL Parameters + + +

Perl CGI

+ +

Perl CGI

+
+
+ + +
+ +
+ + +

CGI File Upload Test

+
+
+ + +
+
+ + +
+ +
+
+ + + +
+ + + + +
+

Advanced Tests

+
Test more complex server behaviors
+ + +

HTTP Redirections

+ + + +

Error Pages

+ + + +

Max Body Size Test

+
+
+ + +
+
+ + +
+ + +
+
+ + +
+

Multi-Host & Multi-Port Testing

+
Test multiple hosts and ports configuration
+ +

Port Tests

+ + +

Server Name Tests

+
Add these domains to your /etc/hosts file:
+