fh-dualies/http-c-erver
Basic http server (v1.0, v1.1) written in c
http-c-server
Projekt Systementwicklung (Sommersemester 2024) - FH Münster
Overview
Members
About this repository
Top-level layout
This repository's contents is divided across following primary sections:
/assetscontains assets used for general purposes/buildcontains compiled files generated by cmake/git-hookscontains git hooks. (Installed using ./scripts/install-git-hooks.sh)/libcontains third-party & own libraries used in the project/scriptscontains scripts used for general purposes/srccontains the source code for the project/src/htdocsrepresents the root directory of the server/testscontains the test code for the project
Libs
file_libis a library that provides functions for file handlingstring_libis a library that provides functions for string handlingtestingis a library that provides functions for testing
Modules
http_modelsis a module that provides models for HTTP requests and responseshttp_parseris a module that provides a parser for HTTP requests and urlshttp_routeris a module that provides a router for HTTP requestshttp_serveris a module that provides a basic HTTP server
Installation
Clone the repository
$ git clone https://github.com/fh-dualies/http-c-erver.gitSwitch to "http-c-erver" folder
$ cd http-c-erverInit using cmake
$ cmake .Compile http-c-erver
$ makeConfiguration
Configure http server
The http server can be configured by changing the values in the main.h file. These are only general configurations.
For more specific configurations, the server itself must be modified (look for constants in *.h files).
Run Project
Run http server
The http server will process the request information and send a response back to the client.
$ ./build/server.outHow to test
Run unit tests
$ ./build/tests.outRun http tests
Note that python3 is required to run the tests.
$ pyhton3 tests/http/tests.pyTest output
Red: Assertion failed
Green: Assertion passed
Conventions
Formatting
This project uses clang-format to enforce a consistent code style.
To format your code, run the following command:
./scripts/format.shCommit messages
This project uses Conventional Commits to enforce a consistent commit message style.
This might help to write better commit messages: Commitlint.io