This project is about writing HTTP server. You will be able to test it with an actual browser.
make
Run ./webserv [config file]. You can choose the config file from configs directory.
./webserv default.conf
If you access http://localhost:8080/, you will get static page like the image below.
If you access http://localhost:8080/cgi/cgi?Gryffindor, you will get dynamic page.
If the wrong page is accessed(http://localhost:8080/Gryffindor), an error page will be displayed.
You can turn on directory listing by configuration file.
./webserv autoindex.conf
make client
./client [host] [port] [use_stdin] [repeat_times]
./client ::1 8080 1 0
You can request static contents from the server. In the example below, the server will return the contents of index.html
GET / HTTP/1.1
You can request dynamic contents from the server. In the example below, the server returns the result of an cgi program that decide on your dormitory at Hogwarts.
GET /cgi/cgi?Gryffindor HTTP/1.1
To run unit tests for each class, execute the following command.
make test
The process of parsing HTTP 1.1 requests is implemented. For more information, please click here.
If you want to know HTTP response about this server, please click here.
- RFC9110(en / ja)
- RFC9112(en / ja)
- Computer Systems: A Programmer's Perspective chapter11, 12
- C++でHTTPサーバを作った話
- C++でHTTPサーバーを作った