Skip to main content

ASGI compatible HTTP/2 web server

Project description

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'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thruster-0.0.8.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thruster-0.0.8-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file thruster-0.0.8.tar.gz.

File metadata

  • Download URL: thruster-0.0.8.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4

File hashes

Hashes for thruster-0.0.8.tar.gz
Algorithm Hash digest
SHA256 845e2b923df366364e554dc2c5bb2ed08ee5db85276ae05a6d8422dadba57e3d
MD5 00c50926584317b64c3dd96fa6de71d5
BLAKE2b-256 00b2ce2429d402eb2a93f746ab62d43f2dcc417ff700c995eb8d898c2a28bdc3

See more details on using hashes here.

File details

Details for the file thruster-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: thruster-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4

File hashes

Hashes for thruster-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 cecf38ab695c61f28510b6c6353a282d999ea4a4ebfcff5b954bad7ebb398552
MD5 97665c7ba604aa890d7502a3b5477b8d
BLAKE2b-256 d55908d16e3b7841f34f74dddf4441f7d9a01d7c5a3e2f4852a71d6c0c93b5ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page