diff --git a/Makefile b/Makefile index e25bbc0..03350d6 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ $(NAME): $(OBJS) $(CXX) $(OBJS) -o $(NAME) debug: - $(CXX) -I includes -Werror -Wextra -Wall -std=c++98 -g $(SRCS) -o $(NAME) -D DEBUG=1 + $(CXX) -I includes -Werror -Wextra -Wall -std=c++98 -g $(SRCS) -o $(NAME) -D DEBUG=1 SILENT=0 verbose: $(CXX) -I includes -Werror -Wextra -Wall -std=c++98 -g $(SRCS) -o $(NAME) -D SILENT=0 diff --git a/includes/webserv.hpp b/includes/webserv.hpp index 5781fc2..b9bc590 100644 --- a/includes/webserv.hpp +++ b/includes/webserv.hpp @@ -1,7 +1,6 @@ #pragma once #ifndef DEBUG #define DEBUG 0 - #define SILENT 0 #endif #ifndef SILENT #define SILENT 1 diff --git a/srcs/load/Server.cpp b/srcs/load/Server.cpp index ee506c7..538d121 100644 --- a/srcs/load/Server.cpp +++ b/srcs/load/Server.cpp @@ -1,4 +1,4 @@ -/** +/* * @file Server.cpp * @brief The servers object. One is created for each config server. * @author Narnaud @@ -87,14 +87,11 @@ Route *Server::choose_route(string uri) { loc_words = split((*loc_it).first, "/"); vec_string::iterator loc_word = loc_words.begin(); vec_string::iterator uri_word = uri_words.begin(); - while (uri_word != uri_words.end()) { - while (uri_word != uri_words.end() && *uri_word == "") uri_word++; - while (loc_word != loc_words.end() && *loc_word == "") loc_word++; - if (loc_word == loc_words.end()) return ((*loc_it).second); - if (*uri_word != *loc_word) break; - uri_word++; - loc_word++; + while (*loc_word == *uri_word) { + while (*++loc_word == "") {} + while (*++uri_word == "") {} } + if (loc_word == loc_words.end()) return ((*loc_it).second); } return this; } diff --git a/srcs/sock/Master.cpp b/srcs/sock/Master.cpp index 84ebdf3..21407f6 100644 --- a/srcs/sock/Master.cpp +++ b/srcs/sock/Master.cpp @@ -40,7 +40,7 @@ Master::Master(ip_port_t list) : _listen(list) { #ifdef __APPLE__ fcntl(socket, F_SETFL, O_NONBLOCK); #endif - if (!SILENT) cout << "New master socket with fd " << _fd << " which listen " << ip << ":" << port << "\n"; + cout << "New master socket with fd " << _fd << " which listen " << ip << ":" << port << "\n"; _pollfds[_poll_id_amount].fd = _fd; _pollfds[_poll_id_amount].events = POLLIN | POLLPRI; _poll_id = _poll_id_amount;