https://github.com/icingworld/webserver
A simple WebServer for linux
https://github.com/icingworld/webserver
cpp epoll linux webserver
Last synced: 4 months ago
JSON representation
A simple WebServer for linux
- Host: GitHub
- URL: https://github.com/icingworld/webserver
- Owner: Icingworld
- Created: 2024-04-18T10:08:41.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-15T08:57:34.000Z (11 months ago)
- Last Synced: 2024-07-15T10:45:20.755Z (11 months ago)
- Topics: cpp, epoll, linux, webserver
- Language: C++
- Homepage:
- Size: 146 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: ReadMe.md
Awesome Lists containing this project
README
# WebServer
A webserver coded with c/c++ working on linux
## 1. Introduction
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 filesHere 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.

## 2. Dependences
+ gcc/g++
+ cmake## 3. How to build
You could build this project in a specific directory, such as `build`. Here is an example below.
```bash
mkdir build && cd build
``````bash
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.```bash
make
``````bash
sudo make install
````sudo` is neccessary because some directories like `/usr/` and `/var/` might be out of auth.
## 4. How to run
Once you have built the project, you can run the excutable file `webserver` now. `sudo` is neccessary also.
```bash
sudo ./webserver
```## 5. WebBench
If you want to test the server, `webbench` has already been included.
```bash
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](webbench/README.md). Here is an example, which means it simulates 200 clients using HTTP/1.1 to request the url in 30 seconds.
```bash
./webbench -c 200 -t 30 -2 http://127.0.0.1:your_port/
```## 6. Todo
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