mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-12-05 13:50:26 +08:00
爬虫规则中将php改为php\b,避免屏蔽某些安卓WebView
This commit is contained in:
@@ -457,7 +457,7 @@ func HTTPFirewallTemplate() *HTTPFirewallPolicy {
|
|||||||
IsOn: true,
|
IsOn: true,
|
||||||
Param: "${userAgent}",
|
Param: "${userAgent}",
|
||||||
Operator: HTTPFirewallRuleOperatorMatch,
|
Operator: HTTPFirewallRuleOperatorMatch,
|
||||||
Value: `python|pycurl|http-client|httpclient|apachebench|nethttp|http_request|java|perl|ruby|scrapy|php|rust`,
|
Value: `python|pycurl|http-client|httpclient|apachebench|nethttp|http_request|java|perl|ruby|scrapy|php\b|rust`,
|
||||||
IsCaseInsensitive: true,
|
IsCaseInsensitive: true,
|
||||||
})
|
})
|
||||||
set.AddRule(&HTTPFirewallRule{
|
set.AddRule(&HTTPFirewallRule{
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package firewallconfigs_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/iwind/TeaGo/assert"
|
||||||
|
"regexp"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestUserAgentMatch_PHP(t *testing.T) {
|
||||||
|
var a = assert.NewAssertion(t)
|
||||||
|
|
||||||
|
var expr = `python|pycurl|http-client|httpclient|apachebench|nethttp|http_request|java|perl|ruby|scrapy|php\b|rust`
|
||||||
|
var reg = regexp.MustCompile(expr)
|
||||||
|
a.IsTrue(reg.MatchString("php"))
|
||||||
|
a.IsTrue(reg.MatchString("php/5.0"))
|
||||||
|
a.IsFalse(reg.MatchString("php110"))
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user