diff --git a/pkg/filtermanager/api/api.go b/pkg/filtermanager/api/api.go index 06be7451..890566b0 100644 --- a/pkg/filtermanager/api/api.go +++ b/pkg/filtermanager/api/api.go @@ -6,12 +6,12 @@ import ( type DecodeWholeRequestFilter interface { NeedDecodeWholeRequest(headers api.RequestHeaderMap) bool - DecodeRequest(headers api.RequestHeaderMap, buf api.BufferInstance, trailers api.RequestTrailerMap) ResultAction + DecodeRequest(headers api.RequestHeaderMap, data api.BufferInstance, trailers api.RequestTrailerMap) ResultAction } type EncodeWholeResponseFilter interface { NeedEncodeWholeResponse(headers api.ResponseHeaderMap) bool - EncodeResponse(headers api.ResponseHeaderMap, buf api.BufferInstance, trailers api.ResponseTrailerMap) ResultAction + EncodeResponse(headers api.ResponseHeaderMap, data api.BufferInstance, trailers api.ResponseTrailerMap) ResultAction } type Filter interface { @@ -58,12 +58,12 @@ func (f *PassThroughFilter) EncodeTrailers(trailers ResponseTrailerMap) ResultAc func (f *PassThroughFilter) OnLog() {} func (f *PassThroughFilter) NeedDecodeWholeRequest(headers api.RequestHeaderMap) bool { return false } -func (f *PassThroughFilter) DecodeRequest(headers api.RequestHeaderMap, buf api.BufferInstance, trailers api.RequestTrailerMap) ResultAction { +func (f *PassThroughFilter) DecodeRequest(headers api.RequestHeaderMap, data api.BufferInstance, trailers api.RequestTrailerMap) ResultAction { return Continue } func (f *PassThroughFilter) NeedEncodeWholeResponse(headers api.ResponseHeaderMap) bool { return false } -func (f *PassThroughFilter) EncodeResponse(headers api.ResponseHeaderMap, buf api.BufferInstance, trailers api.ResponseTrailerMap) ResultAction { +func (f *PassThroughFilter) EncodeResponse(headers api.ResponseHeaderMap, data api.BufferInstance, trailers api.ResponseTrailerMap) ResultAction { return Continue } diff --git a/pkg/filtermanager/filtermanager.go b/pkg/filtermanager/filtermanager.go index b7fbe10e..c7c6ca10 100644 --- a/pkg/filtermanager/filtermanager.go +++ b/pkg/filtermanager/filtermanager.go @@ -291,12 +291,13 @@ func (m *filterManager) DecodeData(buf api.BufferInstance, endStream bool) capi. return } m.decodeIdx = i - } else { - // the endStream in DecodeHeaders indicates there is no body, - // which is always false here - if m.handleAction(f.DecodeHeaders(m.reqHdr, false)) { - return - } + continue + } + + // the endStream in DecodeHeaders indicates there is no body, + // which is always false here + if m.handleAction(f.DecodeHeaders(m.reqHdr, false)) { + return } } @@ -388,10 +389,11 @@ func (m *filterManager) EncodeData(buf api.BufferInstance, endStream bool) capi. return } m.encodeIdx = i - } else { - if m.handleAction(f.EncodeHeaders(m.rspHdr, false)) { - return - } + continue + } + + if m.handleAction(f.EncodeHeaders(m.rspHdr, false)) { + return } }