(t *testing.T)
| 6161 | } |
| 6162 | |
| 6163 | func (s) TestEarlyAbortStreamHeaderListSizeCheck(t *testing.T) { |
| 6164 | lis, err := net.Listen("tcp", "localhost:0") |
| 6165 | if err != nil { |
| 6166 | t.Fatalf("Failed to listen: %v", err) |
| 6167 | } |
| 6168 | s := grpc.NewServer() |
| 6169 | defer s.Stop() |
| 6170 | go s.Serve(lis) |
| 6171 | |
| 6172 | conn, err := net.DialTimeout("tcp", lis.Addr().String(), defaultTestTimeout) |
| 6173 | if err != nil { |
| 6174 | t.Fatalf("Failed to dial: %v", err) |
| 6175 | } |
| 6176 | defer conn.Close() |
| 6177 | st := newServerTesterFromConn(t, conn) |
| 6178 | |
| 6179 | // Set a very small MaxHeaderListSize that any response headers would violate. |
| 6180 | st.greetWithSettings(http2.Setting{ID: http2.SettingMaxHeaderListSize, Val: 1}) |
| 6181 | |
| 6182 | // Send a request with an invalid content-type to trigger early abort. |
| 6183 | st.writeHeaders(http2.HeadersFrameParam{ |
| 6184 | StreamID: 1, |
| 6185 | BlockFragment: st.encodeHeader( |
| 6186 | ":method", "POST", |
| 6187 | ":path", "/grpc.testing.TestService/UnaryCall", |
| 6188 | "content-type", "text/plain", // Invalid content-type to trigger early abort |
| 6189 | "te", "trailers", |
| 6190 | ), |
| 6191 | EndStream: true, |
| 6192 | EndHeaders: true, |
| 6193 | }) |
| 6194 | |
| 6195 | // We should receive a RST_STREAM with ErrCodeInternal because the response |
| 6196 | // headers exceed the MaxHeaderListSize limit. |
| 6197 | st.wantRSTStream(http2.ErrCodeInternal) |
| 6198 | } |
| 6199 | |
| 6200 | func (s) TestNetPipeConn(t *testing.T) { |
| 6201 | // This test will block indefinitely if grpc writes both client and server |
nothing calls this directly
no test coverage detected