-
Notifications
You must be signed in to change notification settings - Fork 1
Bug for WebClient pattern. #2
Description
I tried to add a new WebClient for Chrome. But since chrome is gecko like and based on AppleWebKit and Safari, the WebClient that is on top of the array will be returned if the pattern matches.
For example this user agent string (belongs to chrome): Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36 will always return Safari.
Now let's take the following user agent string:
- chrome -
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36 - safari -
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A - firefox -
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1 - phoenix -
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3a) Gecko/20021207 Phoenix/0.5
All 4 of them are based on Mozilla, but safari and chrome are gecko like which according to mozilla:
Claims to be a Mozilla based user agent, which is only true for Gecko browsers like Firefox and Netscape. For all other user agents it means 'Mozilla-compatible'. In modern browsers, this is only used for historical reasons. It has no real meaning anymore
So the Mozilla part may be ignored.
As for chrome, it is based on apple webkit and safari. The only difference in the UA string is that the safari one holds the version Version/7.0.3. The regex for safari should contain the Version part as well.
See http://www.useragentstring.com/pages/useragentstring.php?name=Safari