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

Implement the extended CONNECT protocol from RFC 8441 #565

Merged
merged 1 commit into from
Nov 24, 2021
Merged

Conversation

nox
Copy link
Contributor

@nox nox commented Oct 19, 2021

No description provided.

@nox nox force-pushed the rfc8441 branch 4 times, most recently from d1ba660 to 547ed63 Compare October 19, 2021 13:31
@nox
Copy link
Contributor Author

nox commented Oct 19, 2021

@seanmonstar I wrote "Reject :protocol in responses" but I can't find explicit prose about this, and I'm not sure it's worth doing at all. If we do it, should the server also preemptively reject responses returned by the user, with an INTERNAL_ERROR on the wire and a user error?

@nox
Copy link
Contributor Author

nox commented Oct 20, 2021

For "Reject :protocol in responses", we would need to make server::Peer::convert_send_message fallible, there is currently no precedent for making the server reject the response provided by the user's code.

@nox
Copy link
Contributor Author

nox commented Oct 20, 2021

There is also no precedent for rejecting on the client side any malformed response, such as responses with :authority etc, so I'm just not going to reject :protocol there either.

@seanmonstar
Copy link
Member

Ah, we don't already do that? I guess practically that's fine... though it does say "Clients MUST NOT accept a malformed response." 🤷

@nox nox force-pushed the rfc8441 branch 3 times, most recently from 25b4722 to 3a62294 Compare October 21, 2021 10:37
@nox
Copy link
Contributor Author

nox commented Oct 21, 2021

I have a problem, which is that there is no way through neither Connection nor SendRequest to tell h2 "ok, wait for the handshake initial settings to be acknowledged, so it's really hard to check whether the server told us "yeah, you can make an extended connect request".

@nox nox force-pushed the rfc8441 branch 3 times, most recently from e69cff0 to f4720dc Compare October 21, 2021 13:49
@seanmonstar
Copy link
Member

wait for the handshake initial settings to be acknowledged

We should (perhaps in separate PR) add a builder option that when enabled, sends the SETTINGS immediately without waiting for a request, and potentially poll_ready doesn't return ready until the SETTINGS have been acked.

@nox
Copy link
Contributor Author

nox commented Oct 25, 2021

Reject SETTINGS_ENABLE_CONNECT_PROTOCOL from client.

Spec says “Receipt of this parameter by a server does not have any impact.” so shrug.

@nox nox force-pushed the rfc8441 branch 2 times, most recently from d237342 to 6437eba Compare October 25, 2021 09:24
@nox
Copy link
Contributor Author

nox commented Oct 25, 2021

There is now a client test that checks that we properly send :protocol.

@nox
Copy link
Contributor Author

nox commented Oct 25, 2021

I renamed the extension type to just Protocol.

@nox nox force-pushed the rfc8441 branch 2 times, most recently from cfd09e9 to 821ad0c Compare October 25, 2021 13:03
@nox
Copy link
Contributor Author

nox commented Oct 26, 2021

I added a test that a client rejects the setting being changed from 1 to 0, but h2 still acknowledges the new settings just before rejecting them.

@nox
Copy link
Contributor Author

nox commented Nov 2, 2021

I could make Protocol own a HeaderValue instead of a BytesStr, but I don't really see the point of doing that given all other pseudo-headers are represented with a BytesStr, and making this change would also require a set_pseudo! refactor.

@nox
Copy link
Contributor Author

nox commented Nov 2, 2021

I've decided to not implement new user error cases on the client side given there are none for normal connect requests either anyway.

@nox nox marked this pull request as ready for review November 2, 2021 10:16
Copy link
Member

@seanmonstar seanmonstar left a comment

Choose a reason for hiding this comment

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

I think this looks great! Everything looks taken care of, all the situations have tests. Impressive!

@seanmonstar
Copy link
Member

I'll leave merging up to you if there's anything you want to finish.

@nox nox merged commit 87969c1 into master Nov 24, 2021
@nox nox deleted the rfc8441 branch November 24, 2021 09:05
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