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

Server can't upgrade from h1 to h2c #3235

Closed
kptfh opened this issue Jan 2, 2019 · 7 comments
Closed

Server can't upgrade from h1 to h2c #3235

kptfh opened this issue Jan 2, 2019 · 7 comments
Labels
Specification For all industry Specifications (IETF / Servlet / etc)

Comments

@kptfh
Copy link

kptfh commented Jan 2, 2019

While running testFeignJava11H2cWithPayload test using Java 11 http client
get GOAWAY frame with Debugdata: invalid_preface
Here is how Jetty server configured: Jetty H2c

@kptfh
Copy link
Author

kptfh commented Jan 3, 2019

Figured out that HTTP2Connection is trying to parse h1 (Upgrade:h2c) message and throws java.io.IOException: 1/invalid_preface

@kptfh
Copy link
Author

kptfh commented Jan 3, 2019

Narrowing scope of issue got that upgade from h1.1 to h2c goes well for GET requests but fails for POST

@joakime
Copy link
Contributor

joakime commented Jan 3, 2019

https://tools.ietf.org/html/rfc7540#section-3.2

Looks like the HTTP/2 spec would support methods other then GET.
It is also not recommended to have request body content during the upgrade (as the request body content will block the upgrade and not be performed via HTTP/2).

@joakime joakime added the Specification For all industry Specifications (IETF / Servlet / etc) label Jan 3, 2019
@sbordet
Copy link
Contributor

sbordet commented Jan 4, 2019

The HTTP/2 spec delegates to the HTTP/1.1 spec for the upgrade, which does not mandate the use of the GET method.
However, I have never seen an upgrade that is not a GET - not sure we want to support that, especially reading a request content that may never arrive.
@kptfh I would suggest that you change the test - if that's ok you can close this issue.

@tomakehurst
Copy link

Sorry to do a drive-by on a closed issue, but it looks like the JDK will attempt an upgrade by default on a PUT and with plain text and chunked request body this blows up.

This test illustrates this:
https://github.com/wiremock/wiremock/blob/http2-plaintext-upgrade-problem/src/test/java/com/github/tomakehurst/wiremock/jetty11/Http2AcceptanceTest.java#L70

Not sure whether this is a Jetty or JDK client issue, but since there are many clients that wrap it it'd be good to know if there's a way forward other than disabling HTTP/2 completely on the server.

@sbordet
Copy link
Contributor

sbordet commented Mar 28, 2024

@tomakehurst can you please open a new issue?

@tomakehurst
Copy link

Sure: #11588

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Specification For all industry Specifications (IETF / Servlet / etc)
Projects
None yet
Development

No branches or pull requests

4 participants