amate / Proxydomo

ローカルで動作するプロクシフィルタリングソフトです
http://www31.atwiki.jp/lafe/pages/37.html
GNU General Public License v2.0
74 stars 12 forks source link

Webpage filter should add type "text/plain" #21

Closed 0rt closed 7 years ago

0rt commented 8 years ago

Some site transfer JSON or Flash ads. data in text/plain, which proxydomo don't filter now.

in requestmanager.cpp: line 1531 else if (type == "plain") { m_filterOwner.fileType == "plain"; return true; }

amate commented 8 years ago

次のバージョンで$TYPEに"plain"を指定できるようにしますが デフォルトでWebフィルターに通してしまうのは今までの互換を崩してしまうので 以下のフィルターのように自前で$FILTER(true)してもらえればいいかなと思っています

[HTTP headers]
Key = "URL: test1"
In = TRUE
Out = FALSE
Version = ""
Author = ""
Comment = ""
Active = TRUE
Multi = FALSE
URL = "$TYPE(plain)$FILTER(true)"
Bounds = ""
Limit = 2000
Match = ""
Replace = ""
nhantrn commented 8 years ago

I tried v1.63, but it fails to filter this plain json:

[url]

[Patterns]
Name = "dart json test"
Version = ""
Author = ""
Comment = ""
Active = TRUE
Multi = FALSE
URL = "$TYPE(plain)(www.foo.bar)"
Bounds = ""
Limit = 256
Match = ""DiFi"$STOP"
Replace = ""TEST""
amate commented 8 years ago

×$STOP ○$STOP()

nhantrn commented 8 years ago

It still doesn't filter that json response.

Also, if you do the URL Pattern Test on that link with any $TYPE like plain,json,etc, it will not get matched. Only the default $TYPE(htm) get matched.

amate commented 8 years ago

http://www31.atwiki.jp/lafe/pages/44.html

You can specify json, xml or plain. Also, these are not applied to the Web page filter by default.

Please enable the Web page filter using $FILTER(true)

[HTTP headers]
Key = "URL: test1"
In = TRUE
Out = FALSE
Version = ""
Author = ""
Comment = ""
Active = TRUE
Multi = FALSE
URL = "($TYPE(plain)|$TYPE(json))$FILTER(true)"
Bounds = ""
Limit = 2000
Match = ""
Replace = ""
0rt commented 8 years ago

I see, it has to be enable by a HEADERS rule to let the WEB Filter rule start working. Does this switch universal? I mean,is it the following line will restrict plain text filter for the url only matched or just one switch for all? ( My local test show it's universal, but never harm to ask... )

$TYPE(plain)$FILTER(true)foo.com/bar.txt

And there is a related bug report, the TEST won't match when $TYPE(plain) is added in front of the url pattern, which is matched and works in fact.

amate commented 8 years ago

There is a need to change the order to limit to only the URL

foo.com/bar.txt$TYPE(plain)$FILTER(true)

Other $TYPE(...) doesn't match except $TYPE(htm) because the content-type in the TEST is set to text/html.