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

extend the HTTP/3 API for WebTransport support #3362

Merged
merged 8 commits into from
Apr 16, 2022
Merged

Conversation

marten-seemann
Copy link
Member

Builds on top of #3360. Only provides support for bidirectional streams at the moment.

To support WebTransport, we need to be able to "hijack" a stream after reading a HTTP/3 frame of type 0x41. The WebTransport implementation then takes over the stream and writes on the QUIC stream directly.

We also need to be able to "hijack" the connection: After we receive a WebTransport upgrade request from the client, we establish a WebTransport connection. On this connection, it is possible to open new streams (that's why we need the http3.StreamCreator).

A work-in-progress implementation of WebTransport has been started here: https://github.com/marten-seemann/webtransport-go.

cc @ydnar @adriancable

@codecov
Copy link

codecov bot commented Mar 27, 2022

Codecov Report

Merging #3362 (ff6313f) into master (3324736) will decrease coverage by 0.18%.
The diff coverage is 52.54%.

@@            Coverage Diff             @@
##           master    #3362      +/-   ##
==========================================
- Coverage   85.58%   85.39%   -0.18%     
==========================================
  Files         135      135              
  Lines        9872     9906      +34     
==========================================
+ Hits         8448     8459      +11     
- Misses       1047     1065      +18     
- Partials      377      382       +5     
Impacted Files Coverage Δ
http3/client.go 82.07% <23.81%> (-7.22%) ⬇️
http3/response_writer.go 76.47% <33.33%> (-2.70%) ⬇️
http3/server.go 71.90% <45.45%> (-1.35%) ⬇️
http3/body.go 95.56% <80.00%> (-4.44%) ⬇️
http3/frames.go 83.56% <84.62%> (+3.28%) ⬆️
http3/roundtrip.go 93.44% <100.00%> (+0.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3324736...ff6313f. Read the comment docs.

@adriancable
Copy link

@marten-seemann - this is great.

My implementation of webtransport in go (which your PR will, and should, replace) does implement all the other stream types including uni streams, so feel free to use any of my code if it's helpful.

https://github.com/adriancable/webtransport-go

@marten-seemann
Copy link
Member Author

Thank you @adriancable! The main reason that it doesn't have unidirectional stream support yet is that I first wanted to get the basic version running. There are no principal blockers.
We'll need yet another callback on the http3.Server and http3.RoundTripper that allows us to hijack unidirectional streams, as those are not marked as WebTransport streams by the frame type, but by the HTTP/3 stream type.

c.logger.Debugf("error handling stream: %s", err)
}
c.conn.CloseWithError(quic.ApplicationErrorCode(errorFrameUnexpected), "received HTTP/3 frame on bidirectional stream")
}
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to return here to avoid an infinite loop?

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.

3 participants