I set up a (misbehaving) HTTP/2 server that always returns REFUSED_STREAM. Then, I ran curl to make a request. curl retried infinitely.
The HTTP/2 server was set up with haproxy, which always returns REFUSED_STREAM (edit: that is the intended behaviour, when the upstream server closes the TCP connection without sending any data; previously I thought that was a bug on their end). The minimum haproxy configuration file that can reproduce the bug (reproducible on haproxy 2.0.17, 2.1.7, and 2.2.2, but not < 1.9):
timeout connect 5s
timeout client 1m
timeout server 1m
bind *:443 ssl crt /tmp/test.pem alpn h2
server bad 127.0.0.1:1234
The curl command line is simply curl -vk https://127.0.0.1
I expected the following
curl should not retry at all, because I did not set the --retry option.
Or, it should retry a limited number of times, as intended in #5074. The fix in #5074 didn't work because on every retry, the old connection is freed and a new one is created, and thus conn->retrycount is always zero.