Code Monkey home page Code Monkey logo

thruster's Introduction

Thruster

HTTP/2 Server that just works

This is my attempt at writing a fully functional HTTP 2.0 Server in Python. Its a work in progress right now. The server supports the ASGI 1.0 specification. Has no dependency on the hyper/h2 (except hpack) and twisted packages. The HTTP/2 stack is being implemented completely from scratch. Depends on bitstring for handling binary data for the HTTP/2 protocol implementation.

HTTP/2 (Current Status)

  • Implementation of most HTTP/2 frames is done. Implemenation of rest of the frames will be done as use cases arise.
  • All frames are organized in classes, with the Frame class as the parent.
  • ASGI 1.0 is supported. Will be adding support for 2.0 soon.
  • Flow Control (To be added)
  • Stream prioritization (To be added)
  • Works with Django (Tested against Django 1.11 and 2.2)

Usage

Install the package using pip

  • pip3 install thruster

Run the following command:

  • thruster --app path_to_your_asgi_app --cert-file path_to_certificate_file --key-file path_to_key_file
  • eg: thruster --app mysite --cert-file server_cert.crt --key-file server_key.key

--cert-file is expected to be a .crt file and --key-file is expected to be a .key file. If --cert-file and --key-file options are not passed, thruster will look for server.crt and server.key in the current directory. --cert-file and --key-file are required for SSL connections and HTTP2 only works with SSL. You can use --help to know about for more options. If everything goes fine you should see the following output on the terminal.

Serving HTTP on port 8000 ...

The structure of your ASGI application is expected to be something like this. Eg: If you're using django.

root_directory/ asgi.py routing.py settings.py

asgi.py

import os
import django
from channels.routing import get_default_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
django.setup()
application = get_default_application()

routing.py

from channels.routing import ProtocolTypeRouter

application = ProtocolTypeRouter({})

settings.py

ASGI_APPLICATION = 'mysite.routing.application'

thruster's People

Contributors

akshaytakkar avatar akshaytakkar30 avatar blackblood avatar

Stargazers

Nikolaus Schlemm avatar Shekhar Kamble avatar Projjol Banerji avatar

Watchers

 avatar Mahesh Gudi avatar Shekhar Kamble avatar  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.