- sudo apt install php-cgi
- idk, try with brew bro.
In order to make python and ruby cgi works, you must make files executable.
Build a simple http server from scratch (C)
RFC 7230 (message syntax and routing)
RFC 7231 (semantics and content)
RFC 7232 (conditional requests)
The Common Gateway Interface (CGI) Version 1.1
- The C++ standard must be C++ 98. Your project must compile with it.
- No external library, no Boost, etc...
- It must be non-blocking and use only 1 poll (or equivalent) for all the IO between the client and the server (listens includes).
- poll (or equivalent) should check read and write at the same time.
- Your server should never block and the client should be bounce properly if necessary.
- You should never do a read operation or a write operation without going through poll (or equivalent).
- Checking the value of errno is strictly forbidden after a read or a write operation.
- A request to your server should never hang forever.
- You server should have default error pages if none are provided.
- Your program should not leak and should never crash, (even when out of memory if all the initialization is done)
- You can’t use fork for something else than CGI (like php or python etc...)
- You can’t execve another webserver...
- Your program should have a config file in argument or use a default path.
- You don’t need to use poll (or equivalent) before reading your config file.
- You should be able to serve a fully static website.
- Client should be able to upload files.
- Your HTTP response status codes must be accurate.
- You need at least GET, POST, and DELETE methods.
- Stress tests your server it must stay available at all cost.
- choose the port and host of each "server"
- setup the server_names or not
- 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
- limit client body size
- setup routes with one or multiple of the following rules/configuration (routes wont be using regexp):
- define a list of accepted HTTP Methods for the route
- define an HTTP redirection.
- 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
- execute CGI based on certain file extension (for example .php)
- You wonder what a CGI is ?
- Because you won’t call the CGI directly use the full path as PATH_INFO
- Just remembers that for chunked request, your server needs to unchunked it and the CGI will expect EOF as end of the body.
- Same things 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
- The cgi should be run in the correct directory for relativ path file access
- Your server should work with one CGI (php-cgi, python...)
- make the route able to accept uploaded files and configure where it should be saved
- You must provide some configuration files and default basic files to test/demonstrate every feature is working during eval
-
Cours prog reseau c++ - Tcp - Premiers pas en tant que server
-
https://codereview.stackexchange.com/questions/217783/simple-http-server
-
Developing Flexible and High-performance Web Servers with Frameworks and Patterns
-
https://perishablepress.com/stop-using-unsafe-characters-in-urls/#unreserved-characters
-
https://stackoverflow.com/questions/47687379/what-characters-are-allowed-in-http-header-values
- Namespace naming convention
- how to use namespace to separate interface from implementation
- The problems with Avoiding Smurf Naming classes with namespaces
- Multiple classes with the same name, but different namespaces?
- nginx doc
- Creating NGINX Plus and NGINX Configuration Files
- How nginx process request
- all nginx config directives
-
https://stackoverflow.com/questions/16041623/the-best-way-to-handle-config-in-large-c-project
-
https://www.guru99.com/compiler-design-lexical-analysis.html#2
-
https://stackoverflow.com/questions/14954721/what-is-the-difference-between-a-token-and-a-lexeme
-
https://tlevesque.developpez.com/tutoriels/csharp/parser-texte-csharp-sprache/#Lno-III
-
https://visualstudiomagazine.com/articles/2014/06/01/compiler-basics-part-2.aspx
-
c++98 - union restricted for complex type like string...and variant not in c++98...
-
https://www.cs.colostate.edu/~mstrout/CS553Fall06/slides/lecture02a-scanparse.pdf
-
looking for a clear definition of what a tokenizer parser and lexers are
- https://softwareengineering.stackexchange.com/questions/323738/how-can-i-effectively-use-one-file-per-class-in-c
- https://stackoverflow.com/questions/27102956/structuring-c-application-directory-and-folders
- https://www.fluentcpp.com/2017/09/22/make-pimpl-using-unique_ptr/
- https://news.ycombinator.com/item?id=12067809
- https://github.com/for-GET/http-decision-diagram
-
https://www.acunetix.com/websitesecurity/directory-traversal/
-
https://www.joelonsoftware.com/2000/04/06/things-you-should-never-do-part-i/
- https://en.cppreference.com/w/cpp/header/filesystem
- https://www.cppstories.com/2017/08/cpp17-details-filesystem/
- https://stackoverflow.com/questions/40899267/how-similar-are-boost-filesystem-and-the-c-standard-filesystem-library
- http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1030r1.pdf
- http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0218r0.html
-
https://www.fluentcpp.com/2017/09/22/make-pimpl-using-unique_ptr/
-
https://blog.spacepatroldelta.com/a?ID=01500-34f01d9e-2d48-4ea4-a26d-0a3deabfdb4b
https://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html
- https://httpwg.org/specs/rfc7230.html#transfer.codings
- https://httpwg.org/specs/rfc7230.html#chunked.encoding
- https://httpwg.org/specs/rfc7230.html#decoding.chunked
- https://helpx.adobe.com/coldfusion/cfml-reference/reserved-words-and-variables/cgi-environment-cgi-scope-variables/cgi-server-variables.html
- http://www.faqs.org/rfcs/rfc3875.html
- https://www.php.net/manual/fr/reserved.variables.server.php
- https://stackoverflow.com/questions/913626/what-should-a-multipart-http-request-with-multiple-files-look-like
- https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html
- https://developer.mozilla.org/fr/docs/Web/HTML/Element/Input/file
- https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2
- https://dzone.com/articles/understanding-reactor-pattern-thread-based-and-eve
- http://www.kegel.com/c10k.html
- https://hila.sh/2019/12/28/reactor.html
- https://raw.githubusercontent.com/swn73/books/master/Packt.Nginx.HTTP.Server.3rd.Edition.pdf
- https://www.adamtornhill.com/Patterns%20in%20C%205,%20REACTOR.pdf