Giter Club home page Giter Club logo

httpserver's Introduction

Introduction

HttpServer is a C++ library that uses the Qt platform to setup a feature rich, easy-to-use HTTP server.

Two existing Qt HTTP server libraries exist out there already, but the licenses are more restrictive (GPL & LGPL), so I decided to create my own:

  1. QtWebApp
  2. qthttpserver

Features

  • Single-threaded with asynchronous callbacks
  • HTTP/1.1
  • TLS support
  • Compression & decompression (GZIP-only)
  • Easy URL router with regex matching
  • Form parsing (multi-part and www-form-urlencoded)
  • Sending files
  • JSON sending or receiving support
  • Custom error responses (e.g. HTML page or JSON response)

Promises Support

There are two variants of this library, one with and without promise support. Promises allow for easier & cleaner development with asynchronous logic. The two variants are supported via separate branches:

  1. master - No promise support
  2. promises - Promise support

Note: The variant without promise support is considered deprecated and will only be supported via bug fixes in the future. For new development, promises are encouraged. The code will remain in two separate branches until sufficient unit testing & documentation is provided for promises support. If you would like to help, please contribute!

Installing

Prerequisites

  • Qt & Qt Creator for IDE
  • zlib
  • OpenSSL binaries for TLS support (see here)

Building HttpServer

  1. Open HttpServer.pro in Qt Creator.
  2. Create a common.pri file in the top-level directory. This will store any specific include & library paths on a per-machine basis.
    • Append paths to your zlib build with INCLUDEPATH and LIBS
    • Make sure on Windows that the compiled zlib DLL is in your environment PATH variable
  3. Build and run the application
    • Building the application will build the shared library as well as the test application. When you press run, it will run the test application in which you can experiment with the library via the provided URLs

Note: Since this is just a normal Qt project with a pro file, you can compile the project via the command-line with qmake and your platform-specific compiler (i.e. make for Linux or nmake for Windows).

Example

See here for example code using HttpServer.

Roadmap & Bugs

  • TLS session resumption is not supported by Qt currently

Pull requests are welcome (and encouraged) for any or all issues!

License

HttpServer has an MIT-based license.

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.