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

H3: Accept HttpBody in Request<T> and Response<T> #724

Closed
stammw opened this issue Apr 20, 2020 · 7 comments
Closed

H3: Accept HttpBody in Request<T> and Response<T> #724

stammw opened this issue Apr 20, 2020 · 7 comments
Assignees
Labels
h3 Related to the quinn-h3 HTTP/3 implementation

Comments

@stammw
Copy link
Contributor

stammw commented Apr 20, 2020

That is, I think we should leverage the http_body crate's Body trait, which already looks quite similar to what we've got going, and use it in our APIs.

Originally posted by @djc in #723 (comment)

@stammw stammw self-assigned this Apr 20, 2020
@stammw stammw added the h3 Related to the quinn-h3 HTTP/3 implementation label Apr 20, 2020
@stammw
Copy link
Contributor Author

stammw commented Apr 20, 2020

I'm afraid http_body is an interface for upon-hyper layers.

From the hyper code, the h2 glue reads from HttpBody here, then writes into a protocol-specific API here. It also check a bunch of state, among which stream reset check.

I guess we'll have to parametize BodyWriter<B> with a bound on bytes::Buf, and offer some "context + poll" methods to do exactly the same.

The problem with implementing From<http_body::Body> for Body is that we'll bypass the Payload abstraction here.

If we want to hold a http::Body into a quinn_h3::Body variant, we'd have to store it as a &dyn HttpBody and it brings other problems with ownership then.

@djc
Copy link
Member

djc commented Apr 20, 2020

The Payload abstraction is very thin, and I think Sean is okay with removing it. I have a PR to do so: hyperium/hyper#2188

@djc
Copy link
Member

djc commented Apr 20, 2020

I was indeed just in the process of writing a PipeToSendStream variant for H3.

@stammw
Copy link
Contributor Author

stammw commented Apr 20, 2020

Okay, so why not binding BodyWriter<T> to T: http_body::Body directly then ?

@djc
Copy link
Member

djc commented Apr 20, 2020

I think that's what I was suggesting? 😁

@stammw
Copy link
Contributor Author

stammw commented Apr 20, 2020

Haha, yeah, I understood having a Body::Stream(http_body::Body) variant from previous conversations. Makes things easier I guess :)

@stammw
Copy link
Contributor Author

stammw commented May 4, 2020

closed via #734

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
h3 Related to the quinn-h3 HTTP/3 implementation
Projects
None yet
Development

No branches or pull requests

2 participants