trying to get submit form to work...
This commit is contained in:
@@ -92,7 +92,7 @@ void Client::parse_request_headers(std::vector<ServerConfig> &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<std::string, std::string>::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"
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<LocationConfig>::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 ;
|
||||
}
|
||||
|
||||
|
||||
15
www/test/submit_form.html
Normal file
15
www/test/submit_form.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Webserv test Something</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="text-align:center">Webserv in Test</h1>
|
||||
<hr>
|
||||
<p style="text-align:center">Time to submit something:</p>
|
||||
<form action="/upload" method="post">
|
||||
<input type="file" id="myFile" name="filename">
|
||||
<input type="submit">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user