H2 release the stream reservation
I read this comment:
https://github.com/imroc/req/blob/5323efe519c828b9b97dc52f13386e007e5972b5/internal/http2/client_conn_pool.go#L20-L22
But cc.RoundTrip(new(http.Request)) leads to a panic:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x58e3d4]
goroutine 18 [running]:
net/url.(*URL).String(0x0)
/usr/local/go/src/net/url/url.go:810 +0x34
github.com/imroc/req/v3/internal/http2.(*ClientConn).RoundTrip(0xc00031a300, 0xc0003c8200)
/req/internal/http2/transport.go:1162 +0x5
How can we release the stream reservation without doing a real RoundTrip?
Is it enough to just call cc.decrStreamReservations()? Basically instead of doing a roundTrip here, I want to just return information about the TLS Connection - so I haven't called cc.RoundTrip yet, just acquired a connection via GetClientConn.
It's just an internal implementation, which is based on golang.org/x/net/http2, you have no way to call it explicitly.
What specific scenarios would require controlling client connection reservation?
Yes, I am already using an modified version of imroc/req, so this being internal functions/methods is no problem for me.
What specific scenarios would require controlling client connection reservation?
I have added an function PeekTLS to T1 and T2. Its usefull in an SSL MITM scenarios, where one wants to copy some characteristics of the original cert to the "faked" one (e.g. so that its expired when the original one is, etc).
Basically instead of calling roundTrip here, PeekTLS just returns information about the TLS Connection. But since cc.RoundTrip is not called, I want to unreserve it.
For T1 I just use t.tryPutIdleConn(pconn) - I think this is correct?