Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for WebSockets over HTTP/2 #2894

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

SabrinaJewson
Copy link
Contributor

Motivation

WebSockets over HTTP/2 are currently not supported. It is defined in RFC 8441 (websockets over HTTP/3 are defined in RFC 9220 and it is exactly the same as HTTP/2).

Solution

Implement the changes necessary to support them, which just requires looking at the :protocol pseudo-header in the websocket extractor and advertising our support by enabling SETTINGS_ENABLE_CONNECT_PROTOCOL in HTTP/2.

Additionally, I needed to fix the handling of responses to CONNECT requests: Axum was incorrectly adding the Content-Length header to them (see also hyperium/hyper#3748), which was causing things to break.

Copy link
Member

@jplatte jplatte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a very high-quality PR, but I really don't know enough about websockets or HTTP/2 to review it.

@mladedav are you able to review this?

Also @SabrinaJewson would you be willing to maintain the websocket stuff going forward (be pinged on issues and PRs to help)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants