Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
058e84f
Update to the latest black and mypy
pgjones Feb 21, 2022
9b16b1b
Allow control over date header addition
pgjones Feb 21, 2022
8cef567
Utilise the pytest-asyncio strict mode
pgjones Feb 22, 2022
a2df571
Minor typo fixes in Usage tutorial
swagile1 Aug 16, 2022
b87a6c9
Fix mypy issues
pgjones Aug 25, 2022
721864f
Fix docs build issue
pgjones Aug 25, 2022
014ab97
Bugfix ensure lifespan shutdowns occur
pgjones Aug 25, 2022
c9ddfd7
Allow for logging configuration to be loaded from JSON or TOML files
pgjones Aug 25, 2022
df569bd
Close idle Keep-Alive connections on graceful exit
impl Jun 13, 2022
ddfc11f
preserve response headers
synodriver Aug 23, 2022
fe5b44d
Add a test for ddfc11f2da9f84cf9a76e4781cd92d88fd93b4c6
pgjones Aug 26, 2022
dbe0007
Support the early hint extension
pgjones Aug 26, 2022
3d6bd72
Add a github workflow
pgjones Aug 26, 2022
67b637a
Add configuration for read the docs
pgjones Aug 26, 2022
f8125d1
Switch to github rather than gitlab
pgjones Aug 26, 2022
d98faef
Remove unused file
pgjones Aug 26, 2022
96d9297
Bump h2spec to 2.6.0 from 2.2.0
pgjones Aug 26, 2022
9a50f5d
Bugfix don't suppress 412 bodies
pgjones Aug 27, 2022
da9262d
Bugfix send the idle update first on HTTP/1 request receipt
pgjones Aug 27, 2022
625a58a
Fix formatting of da9262d75feff7ec068d5d4ef25adc84224fcb7b
pgjones Aug 27, 2022
c2608a0
Directly support serving WSGI applications
pgjones Aug 28, 2022
5b2aa95
Switch compliance servers from ASGI2 to ASGI3
pgjones Aug 28, 2022
05f7020
Update docs to refer to the logger class
pgjones Aug 28, 2022
eff8fb0
Fix 5b2aa954e44534bc0dd6fcebac11eec9dbaf480b
pgjones Aug 28, 2022
67ff9c9
Alter the process and reloading system
pgjones Aug 29, 2022
707c655
Move the load_application call outside of the loop
pgjones Aug 29, 2022
10f9686
Allow WSGI apps to be served programmatically
pgjones Aug 29, 2022
2a0decc
Bump and release 0.14.0
pgjones Aug 29, 2022
42455cb
Following the release of 0.14.0 bump to +dev
pgjones Aug 29, 2022
fcb768c
Fix Python3.7 compatibility
pgjones Aug 29, 2022
acd713d
Bump and release 0.14.1
pgjones Aug 29, 2022
0f7eff4
Following the release of 0.14.1 bump to +dev
pgjones Aug 29, 2022
66cabb0
Update the readme to note WSGI serving ability
pgjones Aug 29, 2022
4ae32df
Bugfix add missing ASGI version to lifespan scope
pgjones Aug 30, 2022
44cfda1
Preserve the HTTP/1 request header casing through to the ASGI app
pgjones Aug 30, 2022
3f804ce
Bugifx ensure the config loglevel is respected
pgjones Sep 2, 2022
a5bf3ca
Bugfix ensure new processes are spawned not forked
pgjones Sep 3, 2022
5264da4
Bugfix ignore dunder vars in config objects
pgjones Sep 3, 2022
f886f84
Bugfix clarify the subprotocol exception
pgjones Sep 3, 2022
ffb1563
Bump and release 0.14.2
pgjones Sep 3, 2022
2e0b501
Following the release of 0.14.2 bump to +dev
pgjones Sep 3, 2022
68e832a
Revert "Preserve the HTTP/1 request header casing through to the ASGI…
pgjones Sep 4, 2022
d5aa25e
Bugfix stream WSGI responses
pgjones Sep 4, 2022
8c3fc86
Bump and release 0.14.3
pgjones Sep 4, 2022
0bd9570
Following the release of 0.14.3 bump to +dev
pgjones Sep 4, 2022
da5492a
Document default config values in configuration.rst
touilleMan Sep 7, 2022
4645aa0
Add explanation of PicklingErrors
pgjones Sep 14, 2022
7b07da6
Use tomllib/tomli for .toml support
mgorny Dec 19, 2022
eb068c4
Fix typing issue
pgjones Dec 21, 2022
55190e2
Pin wsaccel to avoid Python 2.7 incompatibility
pgjones Dec 21, 2022
3bda9c6
Pin twisted to avoid Python 2.7 incompatibility
pgjones Dec 21, 2022
8ae17ca
bug(lifespan): server hangs on startup failure
s1kpp Jan 13, 2023
5a528ae
Support and test against Python 3.11
pgjones Jul 8, 2023
ebd5b72
Fix mypy issues to ensure that ci passes
pgjones Jul 8, 2023
46575fe
Close websocket with 1011 on internal error (1006 is a client-only code)
samsamoa Mar 18, 2023
8be1e61
Fix tests for 46575fef4cda74a97fc70bd7dfbd7c27514322b3
pgjones Jul 8, 2023
00b7ed5
Run autobahn-testsuite from docker container
Wiseqube Apr 30, 2023
d2c5cd0
Transition to trio > 0.22 utilising exception groups
pgjones Jul 8, 2023
ac07325
Except ConnectionAbortedError as Windows machine can populate WinErro…
tchalupnik Jun 28, 2023
8a3e512
Bugfix ensure that closed is sent on reading end
pgjones Jul 8, 2023
3179d07
Add config option to pass raw h11 headers
thrau Apr 9, 2023
07b0362
Handle read_timeout exception on trio
richardsheridan Feb 28, 2023
5d95d87
Add a publish workflow
pgjones Jul 8, 2023
f79df2c
Bump and release 0.14.4
pgjones Jul 8, 2023
86a04d1
Following the release of 0.14.4 bump to +dev
pgjones Jul 8, 2023
640866f
Improve the NoAppError
pgjones Aug 31, 2023
c5b701c
Fix latest mypy issues
pgjones Aug 31, 2023
7aff85b
Log cancelled requests as well as successful
pgjones Sep 16, 2023
d7990fb
Add some useful flow diagrams
pgjones Sep 16, 2023
96e3fce
Document keyfile_password configuration factor
jwoehr Sep 3, 2023
42ac5db
Only load the application in the main process if the reloader is bein…
mitchej123 Sep 15, 2023
4854ffd
fix: Autoreload error because reausing old sockets
godjangollc Oct 23, 2023
3dc7908
Support Python 3.12 drop Python 3.7
pgjones Oct 8, 2023
8133958
Use more modern asyncio apis
pgjones Oct 28, 2023
76bd00f
Fix fomatting in 4854ffd89e8661213ff20828b7568a9f004803a9
pgjones Oct 28, 2023
30e6f03
Bugfix scope client usage for sock binding
pgjones Oct 28, 2023
662ffa9
Disable multiprocessing if number of workers is 0
pgjones Oct 29, 2023
2724ad6
Bump and release 0.15.0
pgjones Oct 29, 2023
042fd10
Correct the changelog
pgjones Oct 29, 2023
19dfb96
Relax shutdown_trigger annotation
Tinche Nov 1, 2023
a230eb7
Complete 3dc7908d59de48fc25b28cd327e2c70afac3bd93
pgjones Nov 27, 2023
33ed006
Update the installation docs to use pip
pgjones Nov 27, 2023
d94b4b0
Ensure the idle task is stopped on error
pgjones Dec 26, 2023
0e4117d
Fix latest mypy issues
pgjones Dec 26, 2023
926c430
Add a max keep alive requests configuration option
pgjones Dec 26, 2023
5a77873
Correct 926c4303a7298ce53a772cf6cec9a3da75be35a2
pgjones Dec 27, 2023
ebb09a6
Revert "fix: Autoreload error because reausing old sockets"
pgjones Dec 27, 2023
2b0aad3
Send the hinted error from h11 on RemoteProtocolErrors
Nov 16, 2023
1f874fc
Handle `asyncio.CancelledError` when socket is closed without flushing
stopdropandrew Dec 11, 2023
80fa194
update .gitignore
seidnerj Dec 25, 2023
cb443a4
if any of our subprocesses exits with a non-zero exit code, we should…
seidnerj Dec 25, 2023
2d2c62b
Improve WSGI compliance
pgjones Dec 27, 2023
4fc0372
Add ProxyFix middleware
pgjones Dec 28, 2023
125bb00
Switch wsgi.errors to stdout
pgjones Dec 28, 2023
c0468e5
Remove old warning
apollo13 Dec 29, 2023
7c39c68
Support restarting workers after max requests
pgjones Jan 1, 2024
0bb4fb9
Don't error on LocalProtoclErrors for ws streams
pgjones Jan 1, 2024
f8e4e5d
Bump and release 0.16.0
pgjones Jan 1, 2024
b8197d5
Fix the year
pgjones Jan 1, 2024
bc39603
Add max_requests and max_requests_jitter to configuration docs
pgjones Jan 1, 2024
3fbd5f2
Properly set host header to ascii string in ProxyFixMiddleware.
apollo13 Jan 1, 2024
0342e39
fix typing.py formatting issues as per tox
seidnerj Mar 20, 2024
ac7b10e
reverted typing.py formatting fixes as it conflicts with pep8, instea…
seidnerj Mar 20, 2024
06c7ef3
Update ci.yml due to Node.js 16 actions being deprecated
seidnerj Mar 20, 2024
1cd0030
fix tests as per pytest's deprecation warning:
seidnerj Mar 20, 2024
9400eb9
fix test_startup_failure test to support ExceptionGroup exceptions
seidnerj Mar 20, 2024
c37a9ab
fixed all tests
seidnerj Mar 20, 2024
155a1f6
encode headers using latin-1
twoyang0917 Mar 14, 2024
31639ec
Bugfix don't double-access log if the response was sent
pgjones Apr 11, 2024
a099217
Set TCP_NODELAY on sockets
alex-anthropic May 7, 2024
aee69f5
Demonstrate and fix a statsd logging bug
alex-anthropic May 7, 2024
1104034
Bad disconnect demo
alex-anthropic May 8, 2024
3c2b27f
Maybe
alex-anthropic May 9, 2024
f155177
shutdown
alex-anthropic May 9, 2024
db586db
Add a test and fix
alex-anthropic May 9, 2024
ab15524
format
alex-anthropic May 9, 2024
b316c24
more format
alex-anthropic May 9, 2024
2bb1c35
Don't completely crash server on uncaught exception
alex-anthropic May 9, 2024
e340338
Fix import
alex-anthropic May 9, 2024
277a1bd
use exceptiongroup.catch
alex-anthropic May 9, 2024
f285548
Possibly fix
alex-anthropic May 9, 2024
b9b278f
fix dependencies
alex-anthropic May 10, 2024
975d783
explicit exception group
alex-anthropic May 10, 2024
bb34f36
don't log oserror
alex-anthropic May 10, 2024
24aacf4
Bugfix handle already-closed on StreamEnded
merlinz01 Mar 1, 2024
6a9fd70
Remove executable permissions from non-script sources
musicinmybrain Jan 31, 2024
751f6d2
Revert #228
pgjones May 25, 2024
0a23657
Drop exceptiongroup dependency in Python 3.11 and later
musicinmybrain Jan 31, 2024
d264794
Improve the proxy fix docs
pgjones May 26, 2024
81bbb32
Send a 400 if data is received before the websocket is accepted
pgjones May 26, 2024
ab98383
Ensure only a single QUIC timer task per connection
pgjones May 27, 2024
d8de5f2
Support sending trailing headers on h2/h3
pgjones May 27, 2024
116bd8c
Add a dependency on typing extensions
pgjones May 27, 2024
ba3d813
Don't check the internal close_at with QUIC
pgjones May 27, 2024
d1c1a23
Add support for lifespan state
adriangb Mar 11, 2023
a40aa2c
Allow sending of the response before body data arrives
pgjones May 27, 2024
e47757d
Ensure responses are sent with empty bodies for WSGI
pgjones May 27, 2024
d16b503
Improve the trailing headers support
pgjones May 27, 2024
a2e7bce
Bump and release 0.17.0
pgjones May 27, 2024
74d5b95
Revert "Set TCP_NODELAY on sockets"
pgjones May 27, 2024
494268a
Bump and release 0.17.1
pgjones May 27, 2024
c03a75f
Bugfix pass the correct quic connection to the H3 Protocol
pgjones May 27, 2024
7136c61
Bump and release 0.17.2
pgjones May 27, 2024
bc6e1c0
Restore set TCP_NODELAY on TCP sockets
pgjones May 28, 2024
edd0aac
Support uvloop >= 0.18 and the loop_factory argument
pgjones May 28, 2024
bfb0877
Bugfix ensure ExceptionGroup lifespan failures crash the server
pgjones May 28, 2024
c405dea
Bump and release 0.17.3
pgjones May 28, 2024
4cf3528
Bugfix don't handle Cancellation errors in lifespan
pgjones Jun 3, 2024
84d06b8
Improve typing against Trio
jakkdl Jun 4, 2024
6cb9c5c
Bugfix correct the dispatcher middleware root path and path
pgjones Apr 27, 2025
64612a1
add support for thread-based worker
synodriver Sep 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
tox:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- {name: '3.12', python: '3.12', tox: py312}
- {name: '3.11', python: '3.11', tox: py311}
- {name: '3.10', python: '3.10', tox: py310}
- {name: '3.9', python: '3.9', tox: py39}
- {name: '3.8', python: '3.8', tox: py38}
- {name: 'format', python: '3.12', tox: format}
- {name: 'mypy', python: '3.12', tox: mypy}
- {name: 'pep8', python: '3.12', tox: pep8}
- {name: 'package', python: '3.12', tox: package}

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: update pip
run: |
pip install -U wheel
pip install -U setuptools
python -m pip install -U pip
- run: pip install tox

- run: tox -e ${{ matrix.tox }}


h2spec:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- {name: 'asyncio', worker: 'asyncio'}
- {name: 'trio', worker: 'trio'}

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: update pip
run: |
pip install -U wheel
pip install -U setuptools
python -m pip install -U pip
- run: pip install trio .

- name: Run server
working-directory: compliance/h2spec
run: nohup hypercorn --keyfile key.pem --certfile cert.pem -k ${{ matrix.worker }} server:app &

- name: Download h2spec
run: |
wget https://github.com/summerwind/h2spec/releases/download/v2.6.0/h2spec_linux_amd64.tar.gz
tar -xvf h2spec_linux_amd64.tar.gz

- name: Run h2spec
run: ./h2spec -tk -h 127.0.0.1 -p 8000 -o 10

autobahn:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- {name: 'asyncio', worker: 'asyncio'}
- {name: 'trio', worker: 'trio'}

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: update pip
run: |
pip install -U wheel
pip install -U setuptools
python -m pip install -U pip
- run: python3 -m pip install trio .
- name: Run server
working-directory: compliance/autobahn
run: nohup hypercorn -k ${{ matrix.worker }} server:app &

- name: Run Unit Tests
working-directory: compliance/autobahn
run: docker run --rm --network=host -v "${PWD}/:/config" -v "${PWD}/reports:/reports" --name fuzzingclient crossbario/autobahn-testsuite wstest -m fuzzingclient -s /config/fuzzingclient.json && python3 summarise.py
38 changes: 38 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v3
with:
python-version: 3.12

- run: |
pip install poetry
poetry build
- uses: actions/upload-artifact@v3
with:
path: ./dist

pypi-publish:
needs: ['build']
environment: 'publish'

name: upload release to PyPI
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/download-artifact@v3

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: artifact/
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ docs/reference/source/
dist/
.coverage
poetry.lock
.idea/
.DS_Store
80 changes: 0 additions & 80 deletions .gitlab-ci.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

python:
install:
- method: pip
path: .
extra_requirements:
- docs

sphinx:
configuration: docs/conf.py
133 changes: 133 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,136 @@
0.17.3 2024-05-28
-----------------

* Restore set TCP_NODELAY on TCP sockets
* Support uvloop >= 0.18 and the loop_factory argument
* Bugfix ensure ExceptionGroup lifespan failures crash the server.

0.17.2 2024-05-27
-----------------

* Bugfix pass the correct quic connection to the H3 Protocol.

0.17.1 2024-05-27
-----------------

* Bugfix revert set TCP_NODELAY on sockets.

0.17.0 2024-05-27
-----------------

* Set TCP_NODELAY on sockets.
* Support sending trailing headers on h2/h3.
* Add support for lifespan state.
* Allow sending of the response before body data arrives.
* Bugfix properly set host header to ascii string in
ProxyFixMiddleware.
* Bugfix encode headers using latin-1.
* Bugfix don't double-access log if the response was sent.
* Bugfix a statsd logging bug.
* Bugfix handle already-closed on StreamEnded.
* Bugfix send a 400 response if data is received before the websocket
is accepted.
* Bugfix ensure only a single QUIC timer task per connection.
* Bugfix ensure responses are sent with empty bodies for WSGI.

0.16.0 2024-01-01
-----------------

* Add a max keep alive requests configuration option, this mitigates
the HTTP/2 rapid reset attack.
* Return subprocess exit code if non-zero.
* Add ProxyFix middleware to make it easier to run Hypercorn behind a
proxy.
* Support restarting workers after max requests to make it easier to
manage memory leaks in apps.
* Bugfix ensure the idle task is stopped on error.
* Bugfix revert autoreload error because reausing old sockets.
* Bugfix send the hinted error from h11 on RemoteProtocolErrors.
* Bugfix handle asyncio.CancelledError when socket is closed without
flushing.
* Bugfix improve WSGI compliance by closing iterators, only sending
headers on first response byte, erroring if ``start_response`` is
not called, and switching wsgi.errors to stdout.
* Don't error on LocalProtoclErrors for ws streams to better cope with
race conditions.

0.15.0 2023-10-29
-----------------

* Improve the NoAppError to help diagnose why the app has not been
found.
* Log cancelled requests as well as successful to aid diagnositics of
failures.
* Use more modern asyncio apis. This will hopefully fix reported
memory leak issues.
* Bugfix only load the application in the main process if the reloader
is being used.
* Bugfix Autoreload error because reausing old sockets.
* Bugfix scope client usage for sock binding.
* Bugfix disable multiprocessing if number of workers is 0 to support
systems that don't support multiprocessing.

0.14.4 2023-07-08
-----------------

* Bugfix Use tomllib/tomli for .toml support replacing the
unmaintained toml library.
* Bugfix server hanging on startup failure.
* Bugfix close websocket with 1011 on internal error (1006 is a
client-only code).
* Bugfix support trio > 0.22 utilising exception groups (note trio <=
0.22 is not supported).
* Bugfix except ConnectionAbortedError which can be raised on Windows
machines.
* Bugfix ensure that closed is sent on reading end.
* Bugfix handle read_timeout exception on trio.
* Support and test against Python 3.11.
* Add explanation of PicklingErrors.
* Add config option to pass raw h11 headers.

0.14.3 2022-09-04
-----------------

* Revert Preserve response headers casing for HTTP/1 as this breaks
ASGI frameworks.
* Bugfix stream WSGI responses

0.14.2 2022-09-03
-----------------

* Bugfix add missing ASGI version to lifespan scope.
* Bugfix preserve the HTTP/1 request header casing through to the ASGI
app.
* Bugifx ensure the config loglevel is respected.
* Bugfix ensure new processes are spawned not forked.
* Bugfix ignore dunder vars in config objects.
* Bugfix clarify the subprotocol exception.

0.14.1 2022-08-29
-----------------

* Fix Python3.7 compatibility.

0.14.0 2022-08-29
-----------------

* Bugfix only recycle a HTTP/1.1 connection if client is DONE.
* Bugfix uvloop may raise a RuntimeError.
* Bugfix ensure 100ms sleep between Windows workers starting.
* Bugfix ensure lifespan shutdowns occur.
* Bugfix close idle Keep-Alive connections on graceful exit.
* Bugfix don't suppress 412 bodies.
* Bugfix don't idle close upgrade requests.
* Allow control over date header addition.
* Allow for logging configuration to be loaded from JSON or TOML
files.
* Preserve response headers casing for HTTP/1.
* Support the early hint ASGI-extension.
* Alter the process and reloading system such that it should work
correctly in all configurations.
* Directly support serving WSGI applications (and drop support for
ASGI-2, now ASGI-3 only).

0.13.2 2021-12-23
-----------------

Expand Down
Loading
Loading