forked from Pablichu/webserv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TODO
52 lines (49 loc) · 3.83 KB
/
TODO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
• If you need more C functions, you can use them but always prefer C++.
• The C++ standard must be C++ 98. Your project must compile with it.
• No external library, no Boost, etc...
• Try to always use the most "C++" code possible (for example use <cstring> over <string.h>).
• Your server must be compatible with the web browser of your choice.
• You can use every macroanddefinelike FD_SET,FD_CLR,FD_ISSET,FD_ZERO (understanding what they do and how they do it is very useful.)
👍 • You must write an HTTP server in C++ 98. OK
👍 • In the subject and the scale we will mention poll but you can use equivalent like select, kqueue, epoll.
👍 • You should never do a read operation or a write operation without going through poll (or equivalent).
👍 • Your server can listen on multiple ports (See config file).
👍 • Checking the value of errno is strictly forbidden after a read or a write operation.
👍 • You can’t use fork for something else than CGI (like php or python etc...)
👍 • You can’t execve another webserver...
👍 • You don’t need to use poll (or equivalent) before reading your config file.
👍 • Your program should have a config file in argument or use a default path.
👍 • You should be able to serve a fully static website.
👍 • You server should have default error pages if none are provided.
👍 • It must be non-blocking and use only 1 poll (or equivalent) for all the IO between the client and the server (listens includes).
👍 • You need at least GET, POST, and DELETE methods.
👍 • Client should be able to upload files.
👍 • poll (or equivalent) should check read and write at the same time.
👍 • A request to your server should never hang forever.
👁🐽👁👍 • Your server should never block and the client should be bounce properly if necessary.
👍 • Your HTTP response status codes must be accurate.
👍 • We will consider that Nginx is HTTP 1.1 compliant and may be used to compare headers and answer behaviors.
👍 • Stress tests your server it must stay available at all cost.
👁🐽👁👍 • Your program should not leak and should never crash, (even when out of memory if all the initialization is done)
◦ setup routes with one or multiple of the following rules/configuration (routes wont be using regexp):
👍 ∗ define a directory or a file from where the file should be search (for example if url /kapouet is rooted to /tmp/www, url /kapouet/pouic/toto/pouet is /tmp/www/pouic/toto/pouet)
👍 ∗ turn on or off directory listing
👍 ∗ default file to answer if the request is a directory
👍 ∗ define a list of accepted HTTP Methods for the route
👍 ◦ choose the port and host of each "server"
👍 · the cgi should be run in the correct directory for relative path file access
👍 ◦ The first server for a host:port will be the default for this host:port (meaning it will answer to all request that doesn’t belong to an other server)
👍 ◦ setup default error pages
👍 ∗ define an HTTP redirection.
👍 · make the route able to accept uploaded files and configure where it should be saved
👍 ∗ execute CGI based on certain file extension (for example .php)
👍 · Samethings for the output of the CGI.if no content_length is returned from the CGI, EOF will mean the end of the returned data.
👍 · Your program should call the cgi with the file requested as first argument
👍 · Just remembers that for chunked request, your server needs to unchun- ked it and the CGI will expect EOF as end of the body.
👍 ◦ setup the server_names or not
👍 Because you won’t call the CGI directly use the full path as PATH_INFO
👍 · your server should work with one CGI (php-cgi, python...)
👍 ◦ limit client body size (needs to be tested)
<<<<<< BONUS >>>>>>
👍 Multiple CGI
👍 Cookies 🍪