mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-29 11:03:13 +00:00
Match ~d and ~u filters against pretty_host too
Changed the ~u filter in the console UI to match the behavior of mitmweb, which only matches against pretty_url, never against url.
This commit is contained in:
parent
1f37743549
commit
f351d0a307
@ -319,10 +319,14 @@ class FDomain(_Rex):
|
|||||||
code = "d"
|
code = "d"
|
||||||
help = "Domain"
|
help = "Domain"
|
||||||
flags = re.IGNORECASE
|
flags = re.IGNORECASE
|
||||||
|
is_binary = False
|
||||||
|
|
||||||
@only(http.HTTPFlow)
|
@only(http.HTTPFlow)
|
||||||
def __call__(self, f):
|
def __call__(self, f):
|
||||||
return bool(self.re.search(f.request.data.host))
|
return bool(
|
||||||
|
self.re.search(f.request.host) or
|
||||||
|
self.re.search(f.request.pretty_host)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class FUrl(_Rex):
|
class FUrl(_Rex):
|
||||||
@ -339,7 +343,7 @@ class FUrl(_Rex):
|
|||||||
|
|
||||||
@only(http.HTTPFlow)
|
@only(http.HTTPFlow)
|
||||||
def __call__(self, f):
|
def __call__(self, f):
|
||||||
return self.re.search(f.request.url)
|
return self.re.search(f.request.pretty_url)
|
||||||
|
|
||||||
|
|
||||||
class FSrc(_Rex):
|
class FSrc(_Rex):
|
||||||
|
@ -96,7 +96,7 @@ function responseBody(regex){
|
|||||||
function domain(regex){
|
function domain(regex){
|
||||||
regex = new RegExp(regex, "i");
|
regex = new RegExp(regex, "i");
|
||||||
function domainFilter(flow){
|
function domainFilter(flow){
|
||||||
return flow.request && regex.test(flow.request.host);
|
return flow.request && (regex.test(flow.request.host) || regex.test(flow.request.pretty_host));
|
||||||
}
|
}
|
||||||
domainFilter.desc = "domain matches " + regex;
|
domainFilter.desc = "domain matches " + regex;
|
||||||
return domainFilter;
|
return domainFilter;
|
||||||
|
Loading…
Reference in New Issue
Block a user