42Webserver / 42-Vienna-Webserv

This project is about writing our own HTTP server in C++
1 stars 0 forks source link

If we call a cgi and method is not allowed, we don't response anything. #55

Closed windchaser-surf closed 1 month ago

Nikster3k commented 1 month ago

Because we only respond error when "allowed_methods" does not contain method requested. With "cgi_methods" we just tell the Webserver when to call fork etc for cgi`s.

Example:

location /scripts
{
      allowed_methods GET POST;
      cgi_methods POST;
}

when we call GET on uri="/scripts/upload.py" we just get the source code. but on POST we trigger cgi.

when

{
...
       cgi_methods GET;
...
}

and we do POST on uri="/scripts/upload.py" its the same as if we do POST on "/index.html".