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

Revert default HTTP/2 settings sent by the client #2346

Merged
merged 1 commit into from
Sep 9, 2022

Conversation

idelpivnitskiy
Copy link
Member

Motivation:

#2341 changed default HTTP/2 settings that client sends to notify the server it does not support Server Push.

Modification:

  • Set ENABLE_PUSH=0, MAX_CONCURRENT_STREAMS=0 in settings frame that client sends to a server;
  • Validate custom initial settings that users pass to H2ProtocolConfig and throw if users try to override ENABLE_PUSH/MAX_CONCURRENT_STREAMS on the client or set ENABLE_PUSH other than 0 for the server;
  • Include content message in GO_AWAY frame if client receives a Push Stream frame;

Result:

Default client behavior doesn't change, custom settings validated to prevent programming mistakes.

Motivation:

apple#2341 changed default HTTP/2 settings that client sends to notify the
server it does not support Server Push.

Modification:

- Set `ENABLE_PUSH=0, MAX_CONCURRENT_STREAMS=0` in settings frame that
client sends to a server;
- Validate custom initial settings that users pass to `H2ProtocolConfig`
and throw if users try to override ENABLE_PUSH/MAX_CONCURRENT_STREAMS on
the client or set ENABLE_PUSH other than 0 for the server;
- Include content message in GO_AWAY frame if client receives a Push
Stream frame;

Result:

Default client behavior doesn't change, custom settings validated to
prevent programming mistakes.
@@ -37,8 +38,7 @@ final class H2ClientParentChannelInitializer implements ChannelInitializer {

H2ClientParentChannelInitializer(final H2ProtocolConfig config) {
this.config = config;
final io.servicetalk.http.api.Http2Settings h2Settings = config.initialSettings();
nettySettings = toNettySettings(h2Settings);
nettySettings = toNettySettings(config.initialSettings()).pushEnabled(false).maxConcurrentStreams(0L);
Copy link
Member

Choose a reason for hiding this comment

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

If we set pushEnabled to false we don't really need to set maxConcurrentStreams

Copy link
Member Author

Choose a reason for hiding this comment

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

Either way it doesn't hurt. This is what grpc-java does. Let's be consistent.

@idelpivnitskiy idelpivnitskiy merged commit bb54241 into apple:main Sep 9, 2022
@idelpivnitskiy idelpivnitskiy deleted the h2settings branch September 9, 2022 17:24
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