Potential Bug when filtering by specific request header value

I’d like to filter out a specific header (User-Agent which contains parenthesis and spaces), but this is reproducible without those special characters needing escape in regex

Steps to reproduce the problem:
  1. Launch ‘mitmproxy --mode regular’
  2. Presss ‘B’ to launch a browser
  3. Navigate to a site
  4. Attempt to filter using ~hq
Any other comments? What have you tried so far?

If for instance, I were to want to see requests with the common Accept-Header value of ‘deflate, gzip’, I can’t seem to get a working filter value.

“~hq Accept-Header deflate, gzip” or “(~hq Accept-Header deflate, gzip)” or “~hq Accept-Header “deflate, gzip”” I am unable to get the desired results (the same would go for any attempt on a User-Agent which would be more helpful in our use case.

I am able to filter by it having the Header, but not by the specific value. I can get this to work on a header value without a space (i.e. ~hq Host

System information

Mac OS (10.13.6) High Sierra

mitmproxy --version

Mitmproxy: 4.0.4
Python: 3.7.0
OpenSSL: OpenSSL 1.0.2p 14 Aug 2018
Platform: Darwin-17.7.0-x86_64-i386-64bit