added infos on cgi in readme, and testers of the subject, and test folder
This commit is contained in:
83
README.md
83
README.md
@@ -20,6 +20,59 @@
|
|||||||
- **getsockname :** returns the current address to which a socket fd is bound
|
- **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
|
- **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
|
## todo
|
||||||
|
|
||||||
@@ -77,6 +130,35 @@
|
|||||||
- [ ] Your server should never die.
|
- [ ] 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 <form> as three values : "application/x-www-form-urlencoded", "multipart/form-data", "text/plain")
|
||||||
|
GATEWAY_INTERFACE : CGI version (e.g. CGI/1.1)
|
||||||
|
PATH_INFO : if any, path of the resquest in addition to the cgi script path (e.g. for cgi script path = "/usr/web/cgi-bin/script.cgi", and the url = "http://server.org/cgi-bin/script.cgi/house", the PATH-INFO would be "house")
|
||||||
|
PATH_TRANSLATED : full path of the request, like path-to-cgi/PATH_INFO, null if PATH_INFO is null (e.g. for "http://server.org/cgi-bin/prog/the/path", PATH_INFO would be : "/the/path" and PATH_TRANSLATED would be : "/usr/web/cgi-bin/prog/the/path")
|
||||||
|
QUERY_STRING : everything following the ? in the url sent by client (e.g. for url "http://server.org/query?var1=val2&var2=val2", it would be : "var1=val2&var2=val2")
|
||||||
|
REMOTE_ADDR : ip address of the client
|
||||||
|
REMOTE_HOST : host name of the client, empty if not known, or equal to REMOTE_ADDR
|
||||||
|
REMOTE_IDENT : if known, username of the client, otherwise empty, use for logging only
|
||||||
|
REMOTE_USER : username of client, if script is protected and the server support user authentification
|
||||||
|
REQUEST_METHOD : method used for the request (for http, usually POST or GET)
|
||||||
|
SCRIPT_NAME : path to the cgi, relative to the root, used for self-referencing URLs (e.g. "/cgi-bin/script.cgi")
|
||||||
|
SERVER_NAME : name of the server, as hostname, IP address, or DNS (e.g. dns : "www.server.org")
|
||||||
|
SERVER_PORT : the port number your server is listening on (e.g. 80)
|
||||||
|
SERVER_PROTOCOL : protocol used for the request (e.g. HTTP/1.1)
|
||||||
|
SERVER_SOFTWARE : the server software you're using (e.g. Apache 1.3)
|
||||||
|
```
|
||||||
|
[redirect status for php-cgi](https://woozle.org/papers/php-cgi.html)
|
||||||
|
```
|
||||||
|
REDIRECT_STATUS : for exemple, 200
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
## ressources
|
## ressources
|
||||||
|
|
||||||
@@ -86,7 +168,6 @@
|
|||||||
- [bind() vs connect()](https://stackoverflow.com/questions/27014955/socket-connect-vs-bind)
|
- [bind() vs connect()](https://stackoverflow.com/questions/27014955/socket-connect-vs-bind)
|
||||||
- [INADDR_ANY for bind](https://stackoverflow.com/questions/16508685/understanding-inaddr-any-for-socket-programming)
|
- [INADDR_ANY for bind](https://stackoverflow.com/questions/16508685/understanding-inaddr-any-for-socket-programming)
|
||||||
- [hack with CGI](https://www.youtube.com/watch?v=ph6-AKByBU4)
|
- [hack with CGI](https://www.youtube.com/watch?v=ph6-AKByBU4)
|
||||||
|
|
||||||
---
|
---
|
||||||
## code architecture
|
## code architecture
|
||||||
|
|
||||||
|
|||||||
0
YoupiBanane/Yeah/not_happy.bad_extension
Normal file
0
YoupiBanane/Yeah/not_happy.bad_extension
Normal file
0
YoupiBanane/nop/other.pouic
Normal file
0
YoupiBanane/nop/other.pouic
Normal file
0
YoupiBanane/nop/youpi.bad_extension
Normal file
0
YoupiBanane/nop/youpi.bad_extension
Normal file
0
YoupiBanane/youpi.bad_extension
Normal file
0
YoupiBanane/youpi.bad_extension
Normal file
0
YoupiBanane/youpi.bla
Normal file
0
YoupiBanane/youpi.bla
Normal file
BIN
testers/cgi_tester
Executable file
BIN
testers/cgi_tester
Executable file
Binary file not shown.
BIN
testers/tester
Executable file
BIN
testers/tester
Executable file
Binary file not shown.
Reference in New Issue
Block a user