summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmogh Pradeep <amoghbl1@gmail.com>2015-06-25 18:57:12 -0500
committerArlo Breault <arlolra@gmail.com>2015-06-25 21:42:32 -0700
commit749fd988c32e764e7fc8dde1f59ab7f06a63f0cd (patch)
treed23a35745456af51ed9632c52f23d19e8e6e5213
parent682823141993e77cb5151ad655ec612550a678a5 (diff)
Added Orfox user agent identification to regexp
-rw-r--r--utils.go2
-rw-r--r--utils_test.go1
2 files changed, 2 insertions, 1 deletions
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) {