HTTP/2.0 automatic upgrade

#1

According to the documentation,

k6 will use HTTP/1.1 by default when it contacts a server. If, after connection, the server reports to k6 that it supports HTTP/2, k6 will upgrade the connection to HTTP/2 instead. This is all automatic…

However, I saw by the --http-debug option that k6 still uses HTTP/1.1 requests after connection. Is this a bug in k6, in the output of the --http-debug option or is there a way to configure?

k6                 server
HTTP/1.1 -->
                <-- HTTP/2

server reports to k6 that it supports HTTP/2 (by ALPN Extention and with response) 

HTTP/1.1 -->
                <-- HTTP/2
HTTP/1.1 -->
                <-- HTTP/2

It would be also great if we would have an option like “–http2-prior-knowledge” in the curl command to let k6 use HTTP/2 when it contacts a server.

0 Likes

#2

Hi,
Because of the way http2 works there is no way for the server to return us an http2 response if we have sent http1 and we to be okay with it.
What you are seeing is a bug in reporting what protocol we are using. This actually turned out to be documented in the function we are using … and my quick look at this shows me this won’t be easily fixable, but I opened an issue.
So you are definitely getting http2 connections - that is not the problem :slight_smile:
About http2-prior-knowledge - this is used with http2 cleartext (h2c) and have no effect when used with https. Which is to be expected the whole negotiation happens before the first request is send at the making of the connection. I am not really certain if this is supported by anyone in that condition at all. Also we currently don’t support h2c as was discussed here previously. I am not certain how it would work otherwise but will be taken into consideration :wink:

0 Likes

#3

Hi,

Because of the way http2 works there is no way for the server to return us an http2 response if we have sent http1 and we to be okay with it.

Yes, I also wanted to say that. Thanks for confirming that this is a bug in reporting :slightly_smiling_face:

0 Likes