-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from samih713/clean-up
merge: Clean-up into server
- Loading branch information
Showing
37 changed files
with
326 additions
and
16,514 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
.vscode/ | ||
*/objs/ | ||
*/objects/ | ||
*/.cache/ | ||
|
||
*.o | ||
libserver.a | ||
libparser.a | ||
webserver | ||
test_parser | ||
test_server | ||
test_socket | ||
client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
### COLORS #### | ||
BLUE:= \033[1;34m | ||
GREEN:= \033[1;32m | ||
MAGENTA:= \033[1;35m | ||
RED:= \033[1;31m | ||
YELLOW:= \033[1;33m | ||
RESET:= \033[0m | ||
|
||
CXX:= c++ | ||
CXXFLAGS:= -Wall -Werror -Wextra | ||
DEBUGFLAGS:= -ggdb3 -fsanitize=address -D__DEBUG__ | ||
|
||
ifeq ($(shell uname), Linux) | ||
CXXFLAGS += -D__LINUX__ | ||
else ifeq ($(shell uname), Darwin) | ||
CXXFLAGS += -D__MAC__ | ||
endif | ||
|
||
RM:= rm -rf | ||
|
||
INCLUDES:= -I./includes | ||
|
||
SRCS:= main.cpp | ||
OBJS_DIR:= objects | ||
OBJS:= $(SRCS:%.cpp=$(OBJS_DIR)/%.o) | ||
|
||
LIBRARY_FLAGS:= -Lserver/ -lserver -Lparser/ -lparser | ||
|
||
NAME:= webserv | ||
|
||
all: $(NAME) | ||
|
||
run: re | ||
./$(NAME) | ||
|
||
$(NAME): parser server $(OBJS) | ||
@$(CXX) $(CXXFLAGS) $(INCLUDES) $(OBJS) -o $@ $(LIBRARY_FLAGS) | ||
@echo "$(GREEN)[ COMPILE ]$(RESET) $(NAME) is ready.\n" | ||
|
||
$(OBJS_DIR)/%.o: %.cpp | $(OBJS_DIR) | ||
@$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@ | ||
@echo "$(GREEN)[ COMPILE ]$(RESET) $<." | ||
|
||
$(OBJS_DIR): | ||
@mkdir -p objects | ||
|
||
debug: CXXFLAGS += $(DEBUGFLAGS) | ||
debug: all | ||
@echo "$(MAGENTA)[ DEBUG ]$(RESET) $(NAME) is ready for debugging." | ||
|
||
# @make -sC tester/ # need to add tests for parser and server | ||
tests: | ||
@make tests -sC parser/ | ||
@make tests -sC server/ | ||
@echo "$(BLUE)[ TEST ]$(RESET) Ready for testing." | ||
|
||
parser: | ||
@make -sC parser/ | ||
|
||
server: | ||
@make -sC server/ | ||
|
||
clean: | ||
@$(RM) $(OBJS_DIR) *.o | ||
@make clean -sC parser/ > /dev/null 2>&1 | ||
@make clean -sC server/ > /dev/null 2>&1 | ||
@echo "$(RED)[ DELETE ]$(RESET) Removed object files." | ||
|
||
fclean: clean | ||
@$(RM) $(NAME) | ||
@make fclean -sC parser/ > /dev/null 2>&1 | ||
@make fclean -sC server/ > /dev/null 2>&1 | ||
@echo "$(RED)[ DELETE ]$(RESET) Removed $(NAME) and libraries." | ||
|
||
re: fclean all | ||
|
||
.PHONY: clean fclean all re tests server parser debug run |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
int main(void) { | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "ConfigParser.hpp" | ||
|
||
ConfigParser::ConfigParser(std::string file) { | ||
(void) file; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef CONFIG_PARSER_HPP | ||
#define CONFIG_PARSER_HPP | ||
|
||
#include <string> | ||
|
||
class ConfigParser { | ||
public: | ||
ConfigParser(std::string file); | ||
~ConfigParser(); | ||
|
||
private: | ||
ConfigParser(); | ||
|
||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
### COLORS #### | ||
BLUE:= \033[1;34m | ||
GREEN:= \033[1;32m | ||
MAGENTA:= \033[1;35m | ||
RED:= \033[1;31m | ||
YELLOW:= \033[1;33m | ||
RESET:= \033[0m | ||
|
||
CXX:= c++ | ||
CXXFLAGS:= -Wall -Werror -Wextra -std=c++98 | ||
DEBUGFLAGS:= -ggdb3 -fsanitize=address -D__DEBUG__ | ||
|
||
ifeq ($(shell uname), Linux) | ||
CXXFLAGS += -D__LINUX__ | ||
else ifeq ($(shell uname), Darwin) | ||
CXXFLAGS += -D__MAC__ | ||
endif | ||
|
||
RM:= rm -rf | ||
|
||
INCLUDES:= -I./ | ||
|
||
SRCS:= ConfigParser.cpp | ||
|
||
# tester mains | ||
TEST_DIR:= tester | ||
TEST_PARSER:= $(TEST_DIR)/test_parser.cpp | ||
|
||
OBJS_DIR:= objects | ||
OBJS:= $(addprefix $(OBJS_DIR)/, $(SRCS:%.cpp=%.o)) | ||
OBJS_BASENAMES:= $(addprefix $(OBJS_DIR)/,$(notdir $(OBJS))) | ||
|
||
CONFIG_FILES:= config_sample.conf | ||
|
||
NAME:= libparser.a | ||
|
||
all: $(NAME) | ||
|
||
$(NAME): $(OBJS) | ||
@ar rcs $(NAME) $(OBJS) | ||
@echo "$(YELLOW)[ LIBRARY ]$(RESET) $(NAME) is ready.\n" | ||
|
||
$(OBJS_DIR)/%.o: %.cpp | $(OBJS_DIR) | ||
@$(CXX) $(CXXFLAGS) $(INCLUDES) -c $^ -o $(OBJS_DIR)/$(notdir $@) | ||
@echo "$(GREEN)[ COMPILE ]$(RESET) $<." | ||
|
||
$(OBJS_DIR): | ||
@mkdir -p objects | ||
|
||
debug: CXXFLAGS += $(DEBUGFLAGS) | ||
debug: all | ||
@echo "$(MAGENTA)[ DEBUG ]$(RESET) $(NAME) is ready for debugging." | ||
|
||
test_parser: $(TEST_PARSER) debug | ||
@$(CXX) $(CXXFLAGS) $(INCLUDES) -fsanitize=address $(TEST_PARSER) $(NAME) -o $@ | ||
@echo "$(BLUE)[ TEST ]$(RESET) Parser is now ready for testing." | ||
|
||
tests: test_parser | ||
@echo "" | ||
|
||
clean: | ||
@$(RM) $(OBJS_DIR) | ||
@echo "$(RED)[ DELETE ]$(RESET) Removed object files." | ||
|
||
fclean: clean | ||
@$(RM) $(NAME) | ||
@$(RM) test_parser | ||
@echo "$(RED)[ DELETE ]$(RESET) Removed $(NAME) and other executables." | ||
|
||
re: fclean all | ||
|
||
.PHONY: clean fclean all re test_parser tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
server { # php/fastcgi | ||
listen 80; | ||
server_name dq | ||
access_log logs/domain1.access.log main; | ||
root html; | ||
|
||
location ~ \.php$ { | ||
fastcgi_pass 127.0.0.1:1025; | ||
} | ||
} | ||
|
||
server { # simple reverse-proxy | ||
listen 80; | ||
server_name domain2.com www.domain2.com; | ||
access_log logs/domain2.access.log main; | ||
|
||
# serve static files | ||
location ~ ^/(images|javascript|js|css|flash|media|static)/ { | ||
root /var/www/virtual/big.server.com/htdocs; | ||
expires 30d; | ||
} | ||
|
||
# pass requests for dynamic content to rails/turbogears/zope, et al | ||
location / { | ||
proxy_pass http://127.0.0.1:8080; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
int main(void) { | ||
return 0; | ||
} |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.