[tor-commits] [check/master] Added Orfox user agent identification to regexp
arlo at torproject.org
arlo at torproject.org
Fri Jun 26 04:44:36 UTC 2015
commit 749fd988c32e764e7fc8dde1f59ab7f06a63f0cd
Author: Amogh Pradeep <amoghbl1 at gmail.com>
Date: Thu Jun 25 18:57:12 2015 -0500
Added Orfox user agent identification to regexp
---
utils.go | 2 +-
utils_test.go | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/utils.go b/utils.go
index 7174b3c..9fc82d9 100644
--- a/utils.go
+++ b/utils.go
@@ -55,7 +55,7 @@ func GetHost(r *http.Request) (host string, err error) {
return
}
-var TBBUserAgents = regexp.MustCompile(`^Mozilla/5\.0 \(Windows NT 6\.1; rv:[\d]+\.0\) Gecko/20100101 Firefox/[\d]+\.0$`)
+var TBBUserAgents = regexp.MustCompile(`^Mozilla/5\.0 \(((Windows NT 6\.1)|(Android; Mobile)); rv:[\d]+\.0\) Gecko/20100101 Firefox/[\d]+\.0$`)
func LikelyTBB(ua string) bool {
return TBBUserAgents.MatchString(ua)
diff --git a/utils_test.go b/utils_test.go
index b16a475..4f60b57 100644
--- a/utils_test.go
+++ b/utils_test.go
@@ -10,6 +10,7 @@ var UserAgents = map[string]bool{
"Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0": true,
"Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0": true,
"Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0": true,
+ "Mozilla/5.0 (Android; Mobile; rv:24.0) Gecko/20100101 Firefox/24.0": true,
}
func TestLikelyTBB(t *testing.T) {
More information about the tor-commits
mailing list