MCPcopy
hub / github.com/grpc/grpc-go / testServerMaxHeaderListSizeClientIntentionalViolation

Function testServerMaxHeaderListSizeClientIntentionalViolation

test/end2end_test.go:6076–6107  ·  view source on GitHub ↗
(t *testing.T, e env)

Source from the content-addressed store, hash-verified

6074}
6075
6076func testServerMaxHeaderListSizeClientIntentionalViolation(t *testing.T, e env) {
6077 te := newTest(t, e)
6078 te.maxServerHeaderListSize = new(uint32)
6079 *te.maxServerHeaderListSize = 512
6080 te.startServer(&testServer{security: e.security})
6081 defer te.tearDown()
6082
6083 cc, dw := te.clientConnWithConnControl()
6084 tc := &testServiceClientWrapper{TestServiceClient: testgrpc.NewTestServiceClient(cc)}
6085 ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
6086 defer cancel()
6087 stream, err := tc.FullDuplexCall(ctx)
6088 if err != nil {
6089 t.Fatalf("%v.FullDuplexCall(_) = _, %v, want _, <nil>", tc, err)
6090 }
6091 rcw := dw.getRawConnWrapper()
6092 val := make([]string, 512)
6093 for i := range val {
6094 val[i] = "a"
6095 }
6096 // allow for client to send the initial header
6097 time.Sleep(100 * time.Millisecond)
6098 rcw.writeHeaders(http2.HeadersFrameParam{
6099 StreamID: tc.getCurrentStreamID(),
6100 BlockFragment: rcw.encodeHeader("oversize", strings.Join(val, "")),
6101 EndStream: false,
6102 EndHeaders: true,
6103 })
6104 if _, err := stream.Recv(); err == nil || status.Code(err) != codes.Internal {
6105 t.Fatalf("stream.Recv() = _, %v, want _, error code: %v", err, codes.Internal)
6106 }
6107}
6108
6109func (s) TestClientMaxHeaderListSizeServerIntentionalViolation(t *testing.T) {
6110 for _, e := range listTestEnv() {

Calls 13

FullDuplexCallMethod · 0.95
getCurrentStreamIDMethod · 0.95
getRawConnWrapperMethod · 0.80
JoinMethod · 0.80
CodeMethod · 0.80
newTestFunction · 0.70
FatalfMethod · 0.65
RecvMethod · 0.65
startServerMethod · 0.45
tearDownMethod · 0.45
writeHeadersMethod · 0.45

Tested by

no test coverage detected