ALL_METHODS renamed to ANY_METHODS
This commit is contained in:
@@ -66,6 +66,7 @@ void Webserv::_append_base_headers(Client *client)
|
||||
|
||||
void Webserv::_construct_response(Client *client, ServerConfig &server)
|
||||
{
|
||||
// TODO : Move this in read(), stop read if content too large
|
||||
if (client->get_body().size() > server.client_body_limit)
|
||||
{
|
||||
client->status = 413;
|
||||
@@ -77,27 +78,24 @@ void Webserv::_construct_response(Client *client, ServerConfig &server)
|
||||
|
||||
void Webserv::_process_method(Client *client, ServerConfig &server, LocationConfig &location)
|
||||
{
|
||||
unsigned int allow_methods = ALL_METHODS; // TEMP VARIABLE
|
||||
unsigned int allow_methods = ANY_METHODS; // TEMP VARIABLE
|
||||
// after update in ConfigParser, use the "allow_methods" of location.
|
||||
// TODO in ConfigParser : by default if no field in config file, "allow_methods" must be set to ALL_METHODS
|
||||
// TODO in ConfigParser : by default if no field in config file, "allow_methods" must be set to ANY_METHODS
|
||||
|
||||
if (client->get_method() == UNKNOWN)
|
||||
{
|
||||
client->status = 400;
|
||||
client->status = 501;
|
||||
}
|
||||
else if (allow_methods & client->get_method())
|
||||
{
|
||||
switch (client->get_method())
|
||||
{
|
||||
case (GET):
|
||||
_get(client, server, location);
|
||||
break;
|
||||
_get(client, server, location); break;
|
||||
case (POST):
|
||||
_post(client, server, location);
|
||||
break;
|
||||
_post(client, server, location); break;
|
||||
case (DELETE):
|
||||
_delete(client, server, location);
|
||||
break;
|
||||
_delete(client, server, location); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user