-
Tiny is small, iterative HTTP/1.0 web server.
-
Tiny uses the
GETmethod to serve static content (text,HTML,GIF, andJPGfiles) out of./and to serve dynamic content by runningCGIprograms out of./cgi-bin. The default page ishome.html(rather thanindex.html) so that we can view the contents of the directory from a browser. -
Tiny is neither secure nor complete, but it gives students an idea of how a real Web server works. Use for instructional purposes only.
-
The
mainroutine: (1) opens a listening port for connections, then (2) accepts a connection, then (3) serve the client. -
Serving the client is done by: (1) reading the request line and headers, then (2) parsing URI form GET request, then (3) determinig whether it's a static or dynamic and serve it.
-
I used suckless coding-style.
- Compile and run Tiny
git clone https://github.com/Alighorab/Tiny-Web-Server/
cd Tiny-Web-Server
make
./tiny <port> (e.g., 8000)
- Connect to Tiny
- Using
TELNET:
telnet localhost <port>
- Using your web browser:
http://localhost:<port>/
- Send HTTP requests
- Using
TELNET:
- Using your web browser:
tiny.c: The Tiny serverlib.{c,h}: I/O and socket-interface functionsMakefile: Makefile for tiny.chome.html: Test HTML pagegodzilla.gif: Image embedded in home.htmlcgi-bin/adder.c: CGI program that adds two numberscgi-bin/Makefile: Makefile for adder.c

