Git Product home page Git Product logo

http-cpp's Introduction


HTTP SERVER

A basic implementation of an HTTP server done in c++! Linux and Windows friendly too ๐Ÿ™‚.
Explore the docs ยป

Report Bug ยท Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. Contact

About The Project

This is basically a mini project showing one of the major ways in which HTTP servers are implemented. In summary, it uses a TCP socket to listen for incoming requests and sends back a basic HTTP response based on standards set by the RFC documents.

As previously mentioned, this implementation of an HTTP web server basically creates a TCP socket which:

  • listens for incoming requests on a particular socket address (which is mostly a combination of an IP address and a network port)
  • synchronously processes network connections from a queue of threads built up from the listening
  • reads the message sent by a client over the network connection and sends some dummy HTTP response.

Of course, there are many many many ways in which this code can be improved and/or extended, so this is an FYI saying that this is mainly for educational purposes. Do not go off trying to build your own server from scratch for use within production-level projects. Asides from the obvious "try not to re-invent the wheel rhethoric", chances are (with almost a certainty) you will end up with very serious security-related problems.

Jump to Roadmap to see more details about the project structure and its implementation overview.

(back to top)

Built With

(back to top)

Getting Started

This is a pretty simple project with just one requirement:

  • Docker (unless you want to build it manually, then you'd be needing C/C++ compiler).

Prerequisites

You will need to have docker setup on your computer, which can be done fairly easily by following the steps on their official documentation. The version run with docker is the linux version of the HTTP server implementation.

Building and Running

With docker fully setup on your system:

  1. navigate to your desired project directory
  2. Clone the repo
    git clone https://github.com/OsasAzamegbe/http-server.git
    (if you do not have git installed, take a brief detour and follow these instructions).
  3. navigate to the project folder http-server/ and build the docker image
    docker-compose build
  4. start the server
    docker-compose up

When you're done with the server and need it shut down:

  1. open up a second terminal window and navigate to the project folder
  2. bring down the docker container
    docker-compose down

NOTE: if you make any changes to the code, you will have to re-compile as well by simply running step 3 again.

Windows Version

instructions coming soon

(back to top)

Usage

Once your server is up and running with docker-compose up, you can pop into any web browser and navigate to localhost:8080/ to see the default HTTP response sent from the server. There will be an article coming soon where I'll talk more indept about the development of this HTTP server.

For more details, please refer to the Roadmap or the article (link coming soon)

(back to top)

Roadmap

instructions coming soon

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

Contact

Osamudiamen Azamegbe
Medium
[email protected]

Project Link: https://github.com/OsasAzamegbe/http-server

(back to top)

http-cpp's People

Contributors

gambhirsharma avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.