Hiroaki-K4 / webserv

My original simple web server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

webserv

This project is about writing HTTP server. You will be able to test it with an actual browser.



How to build server

make

How to run server

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.



About autoindex

You can turn on directory listing by configuration file.

./webserv autoindex.conf



How to build client

make client

How to run 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



How to run unit tests

To run unit tests for each class, execute the following command.

make test



About the HTTP request parser

The process of parsing HTTP 1.1 requests is implemented. For more information, please click here.



About the HTTP response

If you want to know HTTP response about this server, please click here.



References

About

My original simple web server


Languages

Language:C++ 95.5%Language:Makefile 2.7%Language:HTML 1.0%Language:Shell 0.7%