-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Support unencrypted HTTP/2 connections (i.e. h2c) #970
Comments
Yoshi at the community forum suggested we add something like this curl flag. |
1 similar comment
Yoshi at the community forum suggested we add something like this curl flag. |
A proposal on how something like this (among other things) could be implemented in k6 in a backwards compatible and reasonably performant and user-friendly way: #1045 (comment) |
The hanging behavior described in #971 happens after this Golang change: golang/go@5416204 , released in 1.12. If a `101 Switching Protocols` response is received, `response.Body` will be replaced by an underlying `net.Conn`, and reading it blocks indefinitely without a protocol implementation. This is not a big problem for k6 in this case, since we don't support protocol upgrades with the current HTTP API as shown in the example, so the agreed solution was to detect it and return an error. This Golang change is currently incompatible with client timeouts[1], though this will hopefully be resolved by the time we add support for h2c (#970) or other protocols. [1]: golang/go#31391 Closes #971
The hanging behavior described in #971 happens after this Golang change: golang/go@5416204 , released in 1.12. If a `101 Switching Protocols` response is received, `response.Body` will be replaced by an underlying `net.Conn`, and reading it blocks indefinitely without a protocol implementation. This is not a big problem for k6 in this case, since we don't support protocol upgrades with the current HTTP API as shown in the example, so the agreed solution was to detect it and return an error. This Golang change is currently incompatible with client timeouts[1], though this will hopefully be resolved by the time we add support for h2c (#970) or other protocols. [1]: golang/go#31391 Closes #971
The hanging behavior described in #971 happens after this Golang change: golang/go@5416204 , released in 1.12. If a `101 Switching Protocols` response is received, `response.Body` will be replaced by an underlying `net.Conn`, and reading it blocks indefinitely without a protocol implementation. This is not a big problem for k6 in this case, since we don't support protocol upgrades with the current HTTP API as shown in the example, so the agreed solution was to detect it and return an error. This Golang change is currently incompatible with client timeouts[1], though this will hopefully be resolved by the time we add support for h2c (#970) or other protocols. [1]: golang/go#31391 Closes #971
The hanging behavior described in #971 happens after this Golang change: golang/go@5416204 , released in 1.12. If a `101 Switching Protocols` response is received, `response.Body` will be replaced by an underlying `net.Conn`, and reading it blocks indefinitely without a protocol implementation. This is not a big problem for k6 in this case, since we don't support protocol upgrades with the current HTTP API as shown in the example, so the agreed solution was to detect it and return an error. This Golang change is currently incompatible with client timeouts[1], though this will hopefully be resolved by the time we add support for h2c (#970) or other protocols. [1]: golang/go#31391 Closes #971
The hanging behavior described in #971 happens after this Golang change: golang/go@5416204 , released in 1.12. If a `101 Switching Protocols` response is received, `response.Body` will be replaced by an underlying `net.Conn`, and reading it blocks indefinitely without a protocol implementation. This is not a big problem for k6 in this case, since we don't support protocol upgrades with the current HTTP API as shown in the example, so the agreed solution was to detect it and return an error. This Golang change is currently incompatible with client timeouts[1], though this will hopefully be resolved by the time we add support for h2c (#970) or other protocols. [1]: golang/go#31391 Closes #971
Dear @na-- , Do we have any plan to support h2c connections? Thanks, |
@RoySunnySean007, I thought this was impossible to fix without either a breaking change, or a new However, I had another look, and it seems like things have changed recently on the Go side, with the introduction of a With this change, we may be able to configure support for h2c on the k6 side, without any breaking changes, though it's far from certain. We have to research some more, since the documentation for the |
Thanks @na-- ! |
Out of curiosity, why are you migrating to h2c? I thought that was a very marginal use case for HTTP/2... 😕 |
Dear @na-- , There are additional CPU cost if we use HTTP/2 directly, so dev team decided to use h2c which is not friendly for us to conduct load test...:( |
Hi @na-- , One more reason to support h2c is that h2c is used also in 5G Stand-Alone networks by some mobile operators. BR, |
Dear @na-- , We found we can use curl --http2-prior-knowledge (Tells curl to issue its non-TLS HTTP requests using HTTP/2 without HTTP/1.1 Upgrade) to access our h2c spring boot server. We tried to change AllowHTTP to true in https://github.com/golang/net/blob/master/http2/transport.go, but it doesn't work. Do you have any suggestions? Thx in advance! Thanks, |
It seems like you'd also have to overwrite the Which probably makes it somewhat impossible to have a single HTTP client that supports both HTTP/2 with TLS as well as H2C 😞 |
Dear @na-- This is what we changed: https://github.com/k6io/k6/pull/1968/files Actually for us, we only need to support HTTP/2 w/o TLS Thanks, |
@RoySunnySean007, I commented in the PR, but I haven't delved deeply in the Go HTTP/2 and H2C code to see exactly if my comment would resolve your issues. I suggest experimenting and reading up on the Go HTTP/2 docs in https://pkg.go.dev/golang.org/x/net/http2, but please do not submit a PR unless you figure out some way to make the change in a backwards-compatible manner. |
Sure, thx @na-- for teaching me ! |
Hi I'd also love it if this was possible. Could there be a setting to allow us to control the |
As seen in this forum question, previously the k6 docs indirectly mentioned support for
h2c
(HTTP/2 over cleartext TCP) connections. That was incorrect and I've fixed the docs to reflect that, but I'm also adding this issue so we can actually add support for it in the future. Please, add a 👍 here if you have a use case forh2c
support in k6.From a technical standpoint, we should likely do something like this. The problem is comes from the fact, that we rely on a preconfigured
http.Transport
from the Go stdlib, which we pass throughhttp2.ConfigureTransport(transport)
fromgolang.org/x/net/http2
. We can't directly use thehttp2.Transport
from the example above, because it doesn't contain a bunch of the options thathttp.Transport
has and that we use...Related issues:
The text was updated successfully, but these errors were encountered: