diff --git a/README.md b/README.md index 73c16ab..a9668a1 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,59 @@ - **getsockname :** returns the current address to which a socket fd is bound - **fcntl :** manipulate an open fd, by performing some actions, like duplicate it or changing its flags +--- +## correction + +[correction](https://github.com/AliMaskar96/42-Correction-Sheets/blob/master/ng_5_webserv.pdf) +#### general +- launch the installation of siege with homebrew +- explain the basics of an HTTP server +- ask which function they used for I/O Multiplexing +- ask to get an explanation of how select (or equivalent) is working +- ask if they use only one select (or equivalent) and how they've managed the server accept and the client read/write +- the select (or equivalent) should be in the main loop and should check fd for read and write AT THE SAME TIME, if not please give a 0 and stop the evaluation +- there should be only one read or one write per client per selct (or equivalent). Ask to show the code that goes from the select (or equivalent) to the read and write of a client +- search for all read/recv/write/send on a socket and check that if an error returned the client is removed +- search for all read/recv/write/send and check if the returned value is well checked. (checking only -1 or 0 is not good, you should check both) +- if a check of errno is done after read/recv/write/send, please stop the evaluation and put a mark to 0 +- writing ot reading ANY file descriptor withour going through the select (or equivalent) is strickly FORBIDDEN +#### configuration +- look for the HTTP response status codes list on internet and during this evaluation. if any status codes is wrong don't give related points. +- setup multiple servers with different port +- setup multiple servers with different hostname (use something like: curl --resolve example.com:80:127.0.0.1 http://example.com/) +- setup default error page (try to change the error 404) +- limit the client body (use curl -X POST -H "Content-Type: plain/text" --data "BODY IS HERE write something shorter or longer than body limit") +- setup routes in a server to different directories +- setup a default file to search for if you ask for a directory +- setup a list of method accepted for a certain route (ex: try to delete something with and without permission) +#### basic checks +Using telnet, curl, prepared files demonstrates that the following features work properly: +- GET requests -> should work +- POST requests -> should work +- DELETE requests -> should work +- UNKNOWN requests -> should not produce any crash +- For every test the status code must be good +- upload some file to the server and get it back +#### Check with a browser +- Use the reference browser of the team, open the network part of it and try to connect to the server with it +- Look at the request header and response header +- It should be compatible to serve a fully static website +- Try a wrong URL on the server +- Try to list a directory +- Try a redirected URL +- Try things +#### Port issues +- In the configuration file setup multiple ports and use different websites, use the browser to check that the configuration is working as expected, and show the right website. +- In the configuration try to setup the same port multiple times. It should not work. +- Launch multiple servers at the same time with different configurations but with common ports. Is it working? If it is working, ask why the server should work if one of the configurations isn't working. keep going +#### Siege & stress test +- Use Siege to run some stress tests. +- Availability should be above 99.5% for a simple get on an empty page with a siege -b on that page +- Check if there is no memory leak (monitor the process memory usage it should not go up indefinitely) +- Check if there is no hanging connection +- You should be able to use siege indefinitely without restarting the server (look at siege -b) + + --- ## todo @@ -77,6 +130,35 @@ - [ ] Your server should never die. +--- +## cgi env variables +[cgi env variables](http://www.faqs.org/rfcs/rfc3875.html) +[wikipedia variables environnements cgi](https://fr.wikipedia.org/wiki/Variables_d%27environnement_CGI) +[cgi server variables on adobe](https://helpx.adobe.com/coldfusion/cfml-reference/reserved-words-and-variables/cgi-environment-cgi-scope-variables/cgi-server-variables.html) +``` +AUTH_TYPE : if the srcipt is protected, the authentification method used to validate the user +CONTENT_LENGTH : length of the request content +CONTENT_TYPE : if there is attached information, as with method POST or PUT, this is the content type of the data (e.g. "text/plain", it is set by the attribute "enctype" in html