Skip to content

fillipehmeireles/CHttpServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C HTTP SERVER

last-commit repo-top-language repo-language-count

Developed with

C


Quick Links


Overview

This is a simple http server written in C.
It is a recreational project, the main idea is to learn more about the http protocol. Futhermore, this lib was made to be as lightweight and easy to use, like NodeJS Express or Python Flask.


Features

  • Can receive requests with methods:
    • GET, POST, PATCH, PUT, DELETE, OPTIONS, HEAD
  • Implemented 404 for resource not found
  • Implemented 405 for method not allowed
  • Implemented parameters resources: /hello/<:id> (check the examples)
  • Multithreading

Repository Structure

└── C-HTTP-Server/
    ├── Makefile
    ├── README.md
    ├── examples
    │   └── hello-world
    │       ├── hello_world.c
    │       └── include
    │           ├── cJSON.c
    │           └── cJSON.h
    ├── include
    │   └── server.h
    └── src
        └── server.c

Modules

File Summary
server.h header file include/server.h
File Summary
server.c source code implementation src/server.c

Getting Started

Installation

Because the entire library is only one C file and one header file, you can just copy server.h and server.c to your projects source and start using it.

Tests

To execute tests, run:

/* TODO */

Project Roadmap

  • ► Single thread server
  • ► Multi thread
  • ► Multiple Params resources
  • ► Query Params
  • ► Tests with Unity Lib

Contributing

Contributions are welcome!

  1. Fork the Repository: Start by forking the project repository to your GitHub account.
  2. Clone Locally: Clone the forked repository to your local machine using a Git client.
    git clone https://github.com/fillipehmeireles/C-HTTP-Server
  3. Create a New Branch: Always work on a new branch, giving it a descriptive name.
    git checkout -b new-feature-x
  4. Make Your Changes: Develop and test your changes locally.
  5. Commit Your Changes: Commit with a clear message describing your updates.
    git commit -m 'Implemented new feature x.'
  6. Push to GitHub: Push the changes to your forked repository.
    git push origin new-feature-x
  7. Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.

Once your PR is reviewed and approved, it will be merged into the main branch.


License

This project is under the MIT License.


Acknowledgments

  • In the Examples, it's being used the cJSON lib as parser. This is a very interesting lib, please check out.

Return


About

C HTTP Server from scratch

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published