A simple HTTP server & client for begginers

Simplest HTTP Sockets” is a learning project I developed as a teaching resource. It has good code practices, but trying to keep it simple for readability and understanding.

Source code at GitHub: https://github.com/nesjett/simplest-http-sockets
Documentation site: https://nesjett.github.io/simplest-http-sockets/

The project is not production ready and can be improved in many ways, from better encapsulation to better security algorithms, but as already stated, It aims to provide a starting point for those willing to learn.

This repository IS NOT using any 3rd party libraries, everything is made simple enought to work and be understandable.

Features

Easy server configuration

Use of a configuration file Server configuration

Realtime records

Colored connection records for testing and debugging Colore real time console

Logs

Two log files to record all server requests and errors Access log Error log

Source code at GitHub: https://github.com/nesjett/simplest-http-sockets
Documentation site: https://nesjett.github.io/simplest-http-sockets/

Project structure

  • server/bin
    • Contains all executables for server and for client
  • server/config
    • Contains configuration files for server. This files are used to configure different parameters in the server.
  • server/default_responses
    • Contains the default html response pages, if not provided in the website we want to access.(500, 404, …)
  • server/public_html
    • Contains the publicly accesible site files for the server. Ex: index.html, myWebsite.html, etc.
  • server/logs
    • Contains the log files for access and errors.
  • src
    • Contains all .c y .h files, to get a cleaner code but keeping it readable for begginers.

How to use

To compile: gcc -o ../server/bin/mi_http server.c config_manager.c colors.h constants.h log_manager.c header_manager.c
To execute client: ./client [ip/host] [port] [file]
To execute server: ./server

Source code at GitHub: https://github.com/nesjett/simplest-http-sockets