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

Http2ClientUpgradeCodec makes invalid HTTP1 request (hence http2.helloworld.client example fails for h2c mode) #9115

Closed
TristanPerry opened this issue May 1, 2019 · 0 comments · Fixed by #9177
Milestone

Comments

@TristanPerry
Copy link
Contributor

TristanPerry commented May 1, 2019

Expected behavior

The io.netty.example.http2.helloworld.client.Http2Client example should work in the h2c (HTTP2 cleartext - non-TLS) mode, which is the default for this example unless you set a -Dssl VM param.

Actual behavior

The initial h2c upgrade (HTTP 1 request with upgrade: h2c header) does not contain a host header due to this missing in the Http2ClientUpgradeCodec.setUpgradeHeaders() method, leading to the below console output:

Connected to [127.0.0.1:8080]
User Event Triggered: UPGRADE_ISSUED
User Event Triggered: UPGRADE_REJECTED
Exception in thread "main" java.lang.IllegalStateException: Timed out waiting for settings
at io.netty.example.http2.helloworld.client.Http2SettingsHandler.awaitSettings(Http2SettingsHandler.java:49)
at io.netty.example.http2.helloworld.client.Http2Client.main(Http2Client.java:107)

and the following in wireshark (i.e. the h2c server rejects the upgrade request):

h2c-upgrade-fail

Steps to reproduce

  1. Checkout origin/4.1
  2. Ensure that a h2c server is running locally, e.g. @janweinschenker's jetty-http2-cleartext-demo or separate Jetty.
  3. Run the Http2Client example.

Minimal yet complete reproducer code (or URL to code)

n/a - issue with existing io.netty.example.http2.helloworld.client.Http2Client example

Netty version

4.1 branch (seen issue in latest and 4.1.315)

JVM version (e.g. java -version)

1.8.0_201

OS version (e.g. uname -a)

Ubuntu 18.04.2

@TristanPerry TristanPerry changed the title http2.helloworld.client example fails for h2c (no-TLS) mode Http2ClientUpgradeCodec makes invalid HTTP1 request (hence http2.helloworld.client example fails for h2c mode) May 14, 2019
normanmaurer added a commit that referenced this issue May 23, 2019
… upgrade request

Motivation:

The io.netty.example.http2.helloworld.client.Http2Client example should work in the h2c (HTTP2 cleartext - non-TLS) mode, which is the default for this example unless you set a -Dssl VM param. As we do not set the HOST header some servers do reject the upgrade request.

Modifications:

Set the HOST header

Result:

Fixes #9115.
normanmaurer added a commit that referenced this issue May 27, 2019
… upgrade request (#9177)

Motivation:

The io.netty.example.http2.helloworld.client.Http2Client example should work in the h2c (HTTP2 cleartext - non-TLS) mode, which is the default for this example unless you set a -Dssl VM param. As we do not set the HOST header some servers do reject the upgrade request.

Modifications:

Set the HOST header

Result:

Fixes #9115.
normanmaurer added a commit that referenced this issue May 27, 2019
… upgrade request (#9177)

Motivation:

The io.netty.example.http2.helloworld.client.Http2Client example should work in the h2c (HTTP2 cleartext - non-TLS) mode, which is the default for this example unless you set a -Dssl VM param. As we do not set the HOST header some servers do reject the upgrade request.

Modifications:

Set the HOST header

Result:

Fixes #9115.
@normanmaurer normanmaurer added this to the 4.1.37.Final milestone May 27, 2019
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 a pull request may close this issue.

2 participants