diff --git a/test/end2end_test.go b/test/end2end_test.go index f0b1944c3b05..46d6885db4ff 100644 --- a/test/end2end_test.go +++ b/test/end2end_test.go @@ -6300,7 +6300,7 @@ func testServerMaxHeaderListSizeClientUserViolation(t *testing.T, e env) { cc := te.clientConn() tc := testpb.NewTestServiceClient(cc) - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() metadata.AppendToOutgoingContext(ctx, "oversize", string(make([]byte, 216))) var err error diff --git a/transport/http2_client.go b/transport/http2_client.go index 218b5055a99d..7f9771d38fe9 100644 --- a/transport/http2_client.go +++ b/transport/http2_client.go @@ -215,32 +215,31 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne maxHeaderListSize = *opts.MaxHeaderListSize } t := &http2Client{ - ctx: ctx, - ctxDone: ctx.Done(), // Cache Done chan. - cancel: cancel, - userAgent: opts.UserAgent, - md: addr.Metadata, - conn: conn, - remoteAddr: conn.RemoteAddr(), - localAddr: conn.LocalAddr(), - authInfo: authInfo, - readerDone: make(chan struct{}), - writerDone: make(chan struct{}), - goAway: make(chan struct{}), - awakenKeepalive: make(chan struct{}, 1), - framer: newFramer(conn, writeBufSize, readBufSize, maxHeaderListSize), - fc: &trInFlow{limit: uint32(icwz)}, - scheme: scheme, - activeStreams: make(map[uint32]*Stream), - isSecure: isSecure, - creds: opts.PerRPCCredentials, - kp: kp, - statsHandler: opts.StatsHandler, - initialWindowSize: initialWindowSize, - onSuccess: onSuccess, - nextID: 1, - maxConcurrentStreams: defaultMaxStreamsClient, - // maxRecvHeaderListSize: opts.MaxHeaderListSize, + ctx: ctx, + ctxDone: ctx.Done(), // Cache Done chan. + cancel: cancel, + userAgent: opts.UserAgent, + md: addr.Metadata, + conn: conn, + remoteAddr: conn.RemoteAddr(), + localAddr: conn.LocalAddr(), + authInfo: authInfo, + readerDone: make(chan struct{}), + writerDone: make(chan struct{}), + goAway: make(chan struct{}), + awakenKeepalive: make(chan struct{}, 1), + framer: newFramer(conn, writeBufSize, readBufSize, maxHeaderListSize), + fc: &trInFlow{limit: uint32(icwz)}, + scheme: scheme, + activeStreams: make(map[uint32]*Stream), + isSecure: isSecure, + creds: opts.PerRPCCredentials, + kp: kp, + statsHandler: opts.StatsHandler, + initialWindowSize: initialWindowSize, + onSuccess: onSuccess, + nextID: 1, + maxConcurrentStreams: defaultMaxStreamsClient, streamQuota: defaultMaxStreamsClient, streamsQuotaAvailable: make(chan struct{}, 1), } diff --git a/transport/http_util.go b/transport/http_util.go index 9aea2f404941..e4b1670449b2 100644 --- a/transport/http_util.go +++ b/transport/http_util.go @@ -236,6 +236,8 @@ func decodeMetadataHeader(k, v string) (string, error) { } func (d *decodeState) decodeResponseHeader(frame *http2.MetaHeadersFrame) error { + // frame.Truncated is set to true when framer detects that the current header + // list size hits MaxHeaderListSize limit. if frame.Truncated { return streamErrorf(codes.Internal, "peer header list size exceeded limit") }