From fb3870d68cf0f36fc198d9ed01459fd4950997ec Mon Sep 17 00:00:00 2001 From: Leonid Bugaev Date: Thu, 24 Jan 2019 23:47:14 +0100 Subject: [PATCH] Fix --http-allow-header to filter non existent headers Fix https://github.com/buger/goreplay/issues/604 --- http_modifier.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/http_modifier.go b/http_modifier.go index 8ed611e..c9c3cdc 100644 --- a/http_modifier.go +++ b/http_modifier.go @@ -98,7 +98,11 @@ func (m *HTTPModifier) Rewrite(payload []byte) (response []byte) { for _, f := range m.config.headerFilters { value := proto.Header(payload, f.name) - if len(value) > 0 && !f.regexp.Match(value) { + if len(value) == 0 { + return + } + + if !f.regexp.Match(value) { return } }