[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [check/master] Orfox UA updates, tests also changed



commit 644e1c21b682a911acbea567f55d156a084a8c5f
Author: Amogh Pradeep <amoghbl1@xxxxxxxxx>
Date:   Wed Jul 8 17:23:30 2015 -0500

    Orfox UA updates, tests also changed
---
 utils.go      |    5 +++--
 utils_test.go |    3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/utils.go b/utils.go
index 9fc82d9..0872c15 100644
--- a/utils.go
+++ b/utils.go
@@ -55,10 +55,11 @@ func GetHost(r *http.Request) (host string, err error) {
 	return
 }
 
-var TBBUserAgents = regexp.MustCompile(`^Mozilla/5\.0 \(((Windows NT 6\.1)|(Android; Mobile)); rv:[\d]+\.0\) Gecko/20100101 Firefox/[\d]+\.0$`)
+var TBBUserAgents = regexp.MustCompile(`^Mozilla/5\.0 \(Windows NT 6\.1; rv:[\d]+\.0\) Gecko/20100101 Firefox/[\d]+\.0$`)
+var OrfoxUserAgents = regexp.MustCompile(`^Mozilla/5\.0 \(Android; Mobile; rv:38.0\) Gecko/38.0 Firefox/38.0$`)
 
 func LikelyTBB(ua string) bool {
-	return TBBUserAgents.MatchString(ua)
+	return TBBUserAgents.MatchString(ua) || OrfoxUserAgents.MatchString(ua)
 }
 
 var HaveManual = map[string]bool{
diff --git a/utils_test.go b/utils_test.go
index 4f60b57..aa47df9 100644
--- a/utils_test.go
+++ b/utils_test.go
@@ -10,7 +10,8 @@ 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,
+	"Mozilla/5.0 (Android; Mobile; rv:31.0) Gecko/31.0 Firefox/31.0":                                                           false,
+	"Mozilla/5.0 (Android; Mobile; rv:38.0) Gecko/38.0 Firefox/38.0":                                                           true,
 }
 
 func TestLikelyTBB(t *testing.T) {

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits