Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions cgi-bin/name.pl
Original file line number Diff line number Diff line change
@@ -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 <<EOF;
<html>
<head>
<title>Hello CGI Test</title>
<style>
body { font-family: 'Segoe UI', Arial, sans-serif; background-color: #f5f5f5; color: #333; padding: 20px; }
h1 { color: #3498db; }
p { font-size: 1.2rem; }
</style>
</head>
<body>
<h1>Hello, $name!</h1>
<p>Welcome to the WebServ CGI Perl Test Suite. Your name has been received and displayed successfully.</p>
<p><a href="/" class="btn">Go back to the Test Suite</a></p>
</body>
</html>
EOF

4 changes: 4 additions & 0 deletions cgi-bin/test.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<html><body><h1>Hello from Perl CGI</h1></body></html>";

67 changes: 67 additions & 0 deletions cgi-bin/uploads/Makefile
Original file line number Diff line number Diff line change
@@ -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)
Binary file removed cgi-bin/uploads/en.subject.pdf
Binary file not shown.
Binary file removed cgi-bin/uploads/libstdc++.a
Binary file not shown.
30 changes: 0 additions & 30 deletions cgi-bin/uploads/responseCodes.md

This file was deleted.

1 change: 0 additions & 1 deletion cgi-bin/uploads/test

This file was deleted.

Binary file removed cgi-bin/uploads/test.pdf
Binary file not shown.
38 changes: 0 additions & 38 deletions cgi-bin/uploads/tester.conf

This file was deleted.

6 changes: 3 additions & 3 deletions conf/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
}
Expand Down
Loading