diff --git a/srcs/Client.cpp b/srcs/Client.cpp index f064337..5b2e8a5 100644 --- a/srcs/Client.cpp +++ b/srcs/Client.cpp @@ -92,7 +92,7 @@ void Client::parse_request_headers(std::vector &servers) _parse_request_fields(); // DEBUG -print_client("headers"); +//print_client("headers"); if (status) return; @@ -263,8 +263,7 @@ void Client::clear_script() void Client::print_client(std::string message) { std::map::iterator it; - - std::cout << "\n=== DEBUG PRINT CLIENT ===\n"; +std::cout << "\n=== DEBUG PRINT CLIENT ===\n"; std::cout << message << ":\n----------\n\n" << "raw_request:\n__\n"; ::print_special(raw_request); std::cout << "\n__\n" diff --git a/srcs/config/parser.cpp b/srcs/config/parser.cpp index 9dc09f4..dd33ed7 100644 --- a/srcs/config/parser.cpp +++ b/srcs/config/parser.cpp @@ -194,7 +194,7 @@ void ConfigParser::_set_server_values(ServerConfig *server, \ { if (tmp_val[0].find_first_of(":") == NPOS) { - if (!::isNumeric(tmp_val[0])) + if (!::isNumeric_btw(0, 65535, tmp_val[0])) throw std::invalid_argument("bad port number"); server->host = "0.0.0.0"; server->port = tmp_val[0]; @@ -211,7 +211,7 @@ void ConfigParser::_set_server_values(ServerConfig *server, \ if (!::isNumeric_btw(0, 255, ip[i])) throw std::invalid_argument("bad host ip"); } - if (!::isNumeric(tmp2[1])) + if (!::isNumeric_btw(0, 65535, tmp2[1])) throw std::invalid_argument("bad port number"); server->host = tmp2[0]; server->port = tmp2[1]; diff --git a/srcs/webserv/request.cpp b/srcs/webserv/request.cpp index 0799aa7..8b159f3 100644 --- a/srcs/webserv/request.cpp +++ b/srcs/webserv/request.cpp @@ -52,6 +52,8 @@ int Webserv::_read_request(Client *client) } client->raw_request.append(buf, ret); + print_special(client->raw_request); + if (!client->header_complete) { client->parse_request_headers(_servers); diff --git a/srcs/webserv/response.cpp b/srcs/webserv/response.cpp index 436e478..ddda809 100644 --- a/srcs/webserv/response.cpp +++ b/srcs/webserv/response.cpp @@ -199,17 +199,17 @@ If we get a url that ends in / ignore the last / */ std::string uri = path; - if (uri[uri.size() - 1] == '/') + if (uri[uri.size() - 1] == '/' && uri.size() != 1) uri.erase(uri.size() - 1); for (std::vector::const_iterator it = server.locations.begin(); it != server.locations.end(); it++) { - std::cout << it->path << " -- "; +// std::cout << it->path << " -- "; if (it->path.size() > uri.size()) { - std::cout << "skipping this one\n"; +// std::cout << "skipping this one\n"; continue ; } diff --git a/www/test/submit_form.html b/www/test/submit_form.html new file mode 100644 index 0000000..0688854 --- /dev/null +++ b/www/test/submit_form.html @@ -0,0 +1,15 @@ + + + + Webserv test Something + + +

Webserv in Test

+
+

Time to submit something:

+
+ + +
+ +