cleanup: remove unnecessary ignoreContentType field (#2715)

This commit is contained in:
lyuxuan
2019-03-22 13:56:18 -07:00
committed by GitHub
parent 0e83fbebe8
commit ef9bac2604
3 changed files with 2 additions and 14 deletions

View File

@ -1152,10 +1152,7 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) {
return return
} }
state := &decodeState{ state := &decodeState{}
serverSide: false,
ignoreContentType: !initialHeader,
}
// Initialize isGRPC value to be !initialHeader, since if a gRPC ResponseHeader has been received // Initialize isGRPC value to be !initialHeader, since if a gRPC ResponseHeader has been received
// which indicates peer speaking gRPC, we are in gRPC mode. // which indicates peer speaking gRPC, we are in gRPC mode.
state.data.isGRPC = !initialHeader state.data.isGRPC = !initialHeader

View File

@ -287,8 +287,7 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err
func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream), traceCtx func(context.Context, string) context.Context) (fatal bool) { func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream), traceCtx func(context.Context, string) context.Context) (fatal bool) {
streamID := frame.Header().StreamID streamID := frame.Header().StreamID
state := &decodeState{ state := &decodeState{
serverSide: true, serverSide: true,
ignoreContentType: false,
} }
if err := state.decodeHeader(frame); err != nil { if err := state.decodeHeader(frame); err != nil {
if se, ok := status.FromError(err); ok { if se, ok := status.FromError(err); ok {

View File

@ -139,14 +139,6 @@ type parsedHeaderData struct {
type decodeState struct { type decodeState struct {
// whether decoding on server side or not // whether decoding on server side or not
serverSide bool serverSide bool
// ignoreContentType indicates whether when processing the HEADERS frame, ignoring checking the
// content-type is grpc or not.
//
// Trailers (after headers) should not have a content-type. And thus we will ignore checking the
// content-type.
//
// For server, this field is always false.
ignoreContentType bool
// Records the states during HPACK decoding. It will be filled with info parsed from HTTP HEADERS // Records the states during HPACK decoding. It will be filled with info parsed from HTTP HEADERS
// frame once decodeHeader function has been invoked and returned. // frame once decodeHeader function has been invoked and returned.