mirror of
https://github.com/stefanprodan/podinfo.git
synced 2026-03-03 18:40:21 +00:00
`podinfo --h2c` allows upgrading a HTTP/1.1 connection to HTTP/2 Cleartext. This allows `podinfo` to be used in e.g. a H2C load-test like `echo "GET http://localhost:9898/status/200" | vegeta -h2c`, or a H2C connectivity test like done with `curl -v http2 http://localhost:9898/status/200`. I have manually verified this to work by running `curl -v --http2` on macOS and seeing the H2C upgrade happens onl when `-h2c` is provided to `podinfo`. Without `-h2c`: ``` $ curl -v --http2 localhost:9898/status/200 * Trying ::1... * TCP_NODELAY set * Connected to localhost (::1) port 9898 (#0) > GET /status/200 HTTP/1.1 > Host: localhost:9898 > User-Agent: curl/7.54.0 > Accept: */* > Connection: Upgrade, HTTP2-Settings > Upgrade: h2c > HTTP2-Settings: AAMAAABkAARAAAAAAAIAAAAA > < HTTP/1.1 200 OK < Content-Type: application/json; charset=utf-8 < X-Content-Type-Options: nosniff < Date: Mon, 04 Nov 2019 04:58:01 GMT < Content-Length: 19 < { "status": 200 * Connection #0 to host localhost left intact } ``` With `-h2c`: ``` $ curl -v --http2 localhost:9898/status/200 * Trying ::1... * TCP_NODELAY set * Connected to localhost (::1) port 9898 (#0) > GET /status/200 HTTP/1.1 > Host: localhost:9898 > User-Agent: curl/7.54.0 > Accept: */* > Connection: Upgrade, HTTP2-Settings > Upgrade: h2c > HTTP2-Settings: AAMAAABkAARAAAAAAAIAAAAA > < HTTP/1.1 101 Switching Protocols < Connection: Upgrade < Upgrade: h2c * Received 101 * Using HTTP2, server supports multi-use * Connection state changed (HTTP/2 confirmed) * Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0 * Connection state changed (MAX_CONCURRENT_STREAMS updated)! < HTTP/2 200 < content-type: application/json; charset=utf-8 < x-content-type-options: nosniff < content-length: 19 < date: Mon, 04 Nov 2019 04:58:28 GMT < { "status": 200 * Connection #0 to host localhost left intact } `