From 7b2415be97bb2f2c706f6e2c98c2e5bf95b21138 Mon Sep 17 00:00:00 2001 From: roc Date: Thu, 31 Aug 2023 15:51:02 +0800 Subject: [PATCH] Fix FLOW_CONTROL_ERROR in ImpersonateXXX (#275) --- internal/http2/transport.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/internal/http2/transport.go b/internal/http2/transport.go index 88bb9714..115eab6f 100644 --- a/internal/http2/transport.go +++ b/internal/http2/transport.go @@ -654,7 +654,6 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro cc.cond = sync.NewCond(&cc.mu) - var windowSize int32 = initialWindowSize var headerTableSize uint32 = initialHeaderTableSize for _, setting := range t.Settings { switch setting.ID { @@ -664,12 +663,10 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro t.MaxHeaderListSize = setting.Val case http2.SettingHeaderTableSize: headerTableSize = setting.Val - case http2.SettingInitialWindowSize: - windowSize = int32(setting.Val) } } - cc.flow.add(windowSize) + cc.flow.add(initialWindowSize) // TODO: adjust this writer size to account for frame size + // MTU + crypto/tls record padding. @@ -726,7 +723,7 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro cc.nextStreamID = p.StreamID + 2 } - cc.inflow.init(int32(connFlow) + windowSize) + cc.inflow.init(int32(connFlow) + initialWindowSize) cc.bw.Flush() if cc.werr != nil { cc.Close()