This is a tiny webserver using C++, very simple, weak and vulnerable. It's not for production but study! With socket, thread, it can perform static webpages well. But without cgi, it's still not available to answer POST, so dynamic webpages(x). The original model is tinyhttp(https://tinyhttpd.sourceforge.net/) a lite httpserver written by James David in 1999. This program is my first step to backend web programming, which I'm really interested and have written lots of frontend pages. The program also servers as my program design course's assignment (use C++ to create whatever you like, lines>=1500), though not the initial reason why I write this, it gives me the motivation to start. I have gained lots of knowledge in this program, and deeper my understanding of OOP.
Fork it, Donwload it in ZIP or whatever way you like.
I have only tested it on Windows, but there should be only minial changes to run it on Linux and Mac.
- The header files must be replaced since I'm using WinSock.
- The function
ReadHeader::readheader()in filereadheader.cppis usingS_IFDIRandS_IFMT, which I'm not sure if goes well in other platform. - The original version
Source.cppuses thread that only support windows platform.
The first version is Source.cpp. I write it following these codes and a teaching video in bilibili. It is using C but not C++.
The second version is all other files. This article in medium and this video in Youtube helped me a lot. It rewrites the first version in C++.
There're some future steps I want to implement but I can't promise due to the lack of time.
- Support POST method.
- Log system.
- Support thread.