A webserver coded with c/c++ working on linux
This is a static webserver, which was coded with c/c++ on linux. It hanles GET
requests to generate responses with resources.
Files supported:
htm
/html
js
css
jpg
/jpeg
png
- other plain text files
Here is the frame diagram of my project.
With regard to log system, I use a double buffer async log system, here is the log diagram of it.
- gcc/g++
- cmake
You could build this project in a specific directory, such as build
. Here is an example below.
mkdir build && cd build
cmake ..
In this process, if an error occurred with topics about cmake version, you should modify CMakeLists.txt
and set a suitable value of cmake_minimum_required
according to your environment. Then you're able to move on now.
make
sudo make install
sudo
is neccessary because some directories like /usr/
and /var/
might be out of auth.
Once you have built the project, you can run the excutable file webserver
now. sudo
is neccessary also.
sudo ./webserver
If you want to test the server, webbench
has already been included.
cd webbench && make
You will get an excutable file webbench
. Then run it with some params. More information can be found in webbench/README.md. Here is an example, which means it simulates 200 clients using HTTP/1.1 to request the url in 30 seconds.
./webbench -c 200 -t 30 -2 http://127.0.0.1:your_port/
Since the project is build by such a begginer like me, there are still many works to do. Here is the list.
-
post
method - Structure Modify
- Memory Pool
- Performance Improvement