0 | |
#!/usr/bin/perl
|
1 | |
|
2 | |
use strict;
|
3 | |
use warnings;
|
4 | |
|
5 | |
use Data::Dump qw( dump );
|
6 | |
use Test::More qw( no_plan );
|
7 | |
require_ok('HTTP::BrowserDetect');
|
8 | |
|
9 | |
my @tests = (
|
10 | |
[
|
11 | |
"Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.5) Gecko/20031007 Firebird/0.7",
|
12 | |
"0.7",
|
13 | |
0,
|
14 | |
0.7,
|
15 | |
"Firefox",
|
16 | |
"WinXP",
|
17 | |
"1.5",
|
18 | |
["windows", "win32", "winnt", "winxp", "firefox", "gecko"],
|
19 | |
],
|
20 | |
[
|
21 | |
"Mozilla/1.1 (Windows 3.0; I)",
|
22 | |
"1.1",
|
23 | |
1,
|
24 | |
"0.1",
|
25 | |
"Netscape",
|
26 | |
"Win3x",
|
27 | |
undef,
|
28 | |
["netscape", "windows", "win3x", "win16"],
|
29 | |
],
|
30 | |
[
|
31 | |
"Mozilla/1.1 (Windows 3.1; I)",
|
32 | |
"1.1",
|
33 | |
1,
|
34 | |
"0.1",
|
35 | |
"Netscape",
|
36 | |
"Win3x",
|
37 | |
undef,
|
38 | |
["netscape", "windows", "win31", "win3x", "win16"],
|
39 | |
],
|
40 | |
[
|
41 | |
"Mozilla/2.0 (Win95; I)",
|
42 | |
"2.0",
|
43 | |
2,
|
44 | |
0,
|
45 | |
"Netscape",
|
46 | |
"Win95",
|
47 | |
undef,
|
48 | |
["netscape", "nav2", "windows", "win32", "win95"],
|
49 | |
],
|
50 | |
[
|
51 | |
"Mozilla/2.0 (compatible; MSIE 3.01; Windows 95)",
|
52 | |
"3.01",
|
53 | |
3,
|
54 | |
.01,
|
55 | |
"MSIE",
|
56 | |
"Win95",
|
57 | |
undef,
|
58 | |
["ie", "ie3", "windows", "win32", "win95"],
|
59 | |
],
|
60 | |
[
|
61 | |
"Mozilla/2.0 (compatible; MSIE 3.01; Windows NT)",
|
62 | |
"3.01",
|
63 | |
3,
|
64 | |
.01,
|
65 | |
"MSIE",
|
66 | |
"WinNT",
|
67 | |
undef,
|
68 | |
["ie", "ie3", "windows", "win32", "winnt"],
|
69 | |
],
|
70 | |
[
|
71 | |
"Mozilla/2.0 (compatible; MSIE 3.0; AOL 3.0; Windows 95)",
|
72 | |
"3",
|
73 | |
3,
|
74 | |
0,
|
75 | |
"AOL Browser",
|
76 | |
"Win95",
|
77 | |
undef,
|
78 | |
["ie", "ie3", "windows", "win32", "win95", "aol", "aol3"],
|
79 | |
],
|
80 | |
[
|
81 | |
"Mozilla/2.0 (compatible; MSIE 4.0; Windows 95)",
|
82 | |
"4",
|
83 | |
4,
|
84 | |
0,
|
85 | |
"MSIE",
|
86 | |
"Win95",
|
87 | |
undef,
|
88 | |
["ie", "ie4", "ie4up", "windows", "win32", "win95"],
|
89 | |
],
|
90 | |
[
|
91 | |
"Mozilla/3.0 (compatible; MSIE 4.0; Windows 95)",
|
92 | |
"4.0",
|
93 | |
4,
|
94 | |
0,
|
95 | |
"MSIE",
|
96 | |
"Win95",
|
97 | |
undef,
|
98 | |
["ie", "ie4", "ie4up", "windows", "win32", "win95"],
|
99 | |
],
|
100 | |
[
|
101 | |
"Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)",
|
102 | |
"4.01",
|
103 | |
4,
|
104 | |
0.01,
|
105 | |
"MSIE",
|
106 | |
"Win95",
|
107 | |
undef,
|
108 | |
["ie", "ie4", "ie4up", "windows", "win32", "win95"],
|
109 | |
],
|
110 | |
[
|
111 | |
"Mozilla/4.0 (compatible; MSIE 5.0b2; Windows NT)",
|
112 | |
"5.0",
|
113 | |
5,
|
114 | |
0,
|
115 | |
"MSIE",
|
116 | |
"WinNT",
|
117 | |
undef,
|
118 | |
["ie", "ie5", "ie5up", "ie4up", "windows", "win32", "winnt"],
|
119 | |
],
|
120 | |
[
|
121 | |
"Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)",
|
122 | |
"5.5",
|
123 | |
5,
|
124 | |
0.5,
|
125 | |
"MSIE",
|
126 | |
"WinNT",
|
127 | |
undef,
|
128 | |
[
|
129 | |
"ie",
|
130 | |
"ie5",
|
131 | |
"ie5up",
|
132 | |
"ie55",
|
133 | |
"ie55up",
|
134 | |
"ie4up",
|
135 | |
"windows",
|
136 | |
"win32",
|
137 | |
"winnt",
|
138 | |
],
|
139 | |
],
|
140 | |
[
|
141 | |
"Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0) via proxy gateway Something/1.23",
|
142 | |
"5.5",
|
143 | |
5,
|
144 | |
0.5,
|
145 | |
"MSIE",
|
146 | |
"Win2k",
|
147 | |
undef,
|
148 | |
[
|
149 | |
"ie",
|
150 | |
"ie5",
|
151 | |
"ie5up",
|
152 | |
"ie55",
|
153 | |
"ie55up",
|
154 | |
"ie4up",
|
155 | |
"windows",
|
156 | |
"win32",
|
157 | |
"winnt",
|
158 | |
"win2k",
|
159 | |
],
|
160 | |
],
|
161 | |
[
|
162 | |
"Mozilla/3.0 (Macintosh; I; PPC)",
|
163 | |
"3.0",
|
164 | |
3,
|
165 | |
0,
|
166 | |
"Netscape",
|
167 | |
"Mac",
|
168 | |
undef,
|
169 | |
["netscape", "nav3", "mac", "macppc"],
|
170 | |
],
|
171 | |
[
|
172 | |
"Mozilla/4.0 (compatible; MSIE 5.0; Win32)",
|
173 | |
"5.0",
|
174 | |
5,
|
175 | |
0,
|
176 | |
"MSIE",
|
177 | |
undef,
|
178 | |
undef,
|
179 | |
["ie", "ie4up", "ie5", "ie5up", "windows", "win32"],
|
180 | |
],
|
181 | |
[
|
182 | |
"Mozilla/4.0 (compatible; Opera/3.0; Windows 4.10) 3.50",
|
183 | |
"3.0",
|
184 | |
3,
|
185 | |
0,
|
186 | |
"Opera",
|
187 | |
undef,
|
188 | |
undef,
|
189 | |
["opera", "opera3", "windows"],
|
190 | |
],
|
191 | |
[
|
192 | |
"Mozilla/4.0 (compatible; MSIE 5.0b1; Windows NT 5.0)",
|
193 | |
"5.0",
|
194 | |
5,
|
195 | |
0,
|
196 | |
"MSIE",
|
197 | |
"Win2k",
|
198 | |
undef,
|
199 | |
[
|
200 | |
"ie",
|
201 | |
"ie4up",
|
202 | |
"ie5",
|
203 | |
"ie5up",
|
204 | |
"windows",
|
205 | |
"win32",
|
206 | |
"winnt",
|
207 | |
"win2k",
|
208 | |
],
|
209 | |
],
|
210 | |
[
|
211 | |
"Mozilla/4.06 [en] (Win98; I ;Nav)",
|
212 | |
"4.06",
|
213 | |
4,
|
214 | |
0.06,
|
215 | |
"Netscape",
|
216 | |
"Win98",
|
217 | |
undef,
|
218 | |
["netscape", "nav4", "nav4up", "windows", "win32", "win98"],
|
219 | |
],
|
220 | |
[
|
221 | |
"Mozilla/4.5 [en] (X11; I; FreeBSD 2.2.7-RELEASE i386)",
|
222 | |
"4.5",
|
223 | |
4,
|
224 | |
0.5,
|
225 | |
"Netscape",
|
226 | |
"Unix",
|
227 | |
undef,
|
228 | |
[
|
229 | |
"netscape",
|
230 | |
"nav4",
|
231 | |
"nav4up",
|
232 | |
"nav45",
|
233 | |
"nav45up",
|
234 | |
"bsd",
|
235 | |
"freebsd",
|
236 | |
"unix",
|
237 | |
"x11",
|
238 | |
],
|
239 | |
],
|
240 | |
[
|
241 | |
"Mozilla/3.03Gold (Win95; I)",
|
242 | |
"3.03",
|
243 | |
3,
|
244 | |
0.03,
|
245 | |
"Netscape",
|
246 | |
"Win95",
|
247 | |
undef,
|
248 | |
["netscape", "nav3", "navgold", "windows", "win32", "win95"],
|
249 | |
],
|
250 | |
["Wget/1.4.5", "1.4", 1, 0.4, undef, undef, undef, ["wget", "robot"]],
|
251 | |
[
|
252 | |
"libwww-perl/5.11",
|
253 | |
"5.11",
|
254 | |
5,
|
255 | |
0.11,
|
256 | |
undef,
|
257 | |
undef,
|
258 | |
undef,
|
259 | |
["lwp", "robot"],
|
260 | |
],
|
261 | |
[
|
262 | |
"GetRight/3.2.1",
|
263 | |
"3.2",
|
264 | |
3,
|
265 | |
0.2,
|
266 | |
undef,
|
267 | |
undef,
|
268 | |
undef,
|
269 | |
["getright", "robot"],
|
270 | |
],
|
271 | |
[
|
272 | |
"Mozilla/3.0 (compatible; StarOffice/5.1; Linux)",
|
273 | |
"5.1",
|
274 | |
5,
|
275 | |
0.1,
|
276 | |
undef,
|
277 | |
"Linux",
|
278 | |
undef,
|
279 | |
["linux", "unix", "staroffice"],
|
280 | |
],
|
281 | |
[
|
282 | |
"Mozilla/3.0 (compatible; StarOffice/5.1; Win32)",
|
283 | |
"5.1",
|
284 | |
5,
|
285 | |
0.1,
|
286 | |
undef,
|
287 | |
undef,
|
288 | |
undef,
|
289 | |
["win32", "windows", "staroffice"],
|
290 | |
],
|
291 | |
[
|
292 | |
"iCab/Pre2.0 (Macintosh; I; PPC)",
|
293 | |
"2.0",
|
294 | |
2,
|
295 | |
0,
|
296 | |
undef,
|
297 | |
"Mac",
|
298 | |
undef,
|
299 | |
["mac", "macppc", "icab"],
|
300 | |
],
|
301 | |
[
|
302 | |
"Konqueror/1.1.2",
|
303 | |
"1.1",
|
304 | |
1,
|
305 | |
0.1,
|
306 | |
undef,
|
307 | |
undef,
|
308 | |
undef,
|
309 | |
[
|
310 | |
"konqueror"
|
311 | |
],
|
312 | |
[
|
313 | |
"robot", # RT #30705
|
314 | |
],
|
315 | |
],
|
316 | |
[
|
317 | |
"Lotus-Notes/4.5 ( OS/2 )",
|
318 | |
"4.5",
|
319 | |
4,
|
320 | |
0.5,
|
321 | |
undef,
|
322 | |
"OS2",
|
323 | |
undef,
|
324 | |
["lotusnotes", "os2"],
|
325 | |
],
|
326 | |
#["Java1.0.2", "0.0", 0, 0, undef, undef, undef, ["java"]],
|
327 | |
[
|
328 | |
"Googlebot/1.0 (googlebot\@googlebot.com http://googlebot.com/)",
|
329 | |
"1.0",
|
330 | |
1,
|
331 | |
0,
|
332 | |
undef,
|
333 | |
undef,
|
334 | |
undef,
|
335 | |
["google", "robot"],
|
336 | |
],
|
337 | |
["Nokia-WAP-Toolkit/1.3beta", "1.3", 1, 0.3, undef, undef, undef, ["wap"]],
|
338 | |
["Nokia7110/1.0 (30.05)", "1.0", 1, 0, undef, undef, undef, ["wap"]],
|
339 | |
["UP.Browser/4.1.2a-XXXX", "4.1", 4, 0.1, undef, undef, undef, ["wap"]],
|
340 | |
["Wapalizer/1.0", "1.0", 1, 0, undef, undef, undef, ["wap"]],
|
341 | |
["YourWap/1.16", "1.16", 1, 0.16, undef, undef, undef, ["wap"]],
|
342 | |
[
|
343 | |
"AmigaVoyager/3.3.50 (AmigaOS/PPC)",
|
344 | |
"3.3",
|
345 | |
3,
|
346 | |
0.3,
|
347 | |
undef,
|
348 | |
undef,
|
349 | |
undef,
|
350 | |
["amiga"],
|
351 | |
],
|
352 | |
[
|
353 | |
"fetch/1.0 FreeBSD/4.0-CURRENT (i386)",
|
354 | |
"1.0",
|
355 | |
1,
|
356 | |
0,
|
357 | |
undef,
|
358 | |
"Unix",
|
359 | |
undef,
|
360 | |
["bsd", "freebsd", "unix", "robot"],
|
361 | |
],
|
362 | |
[
|
363 | |
"Emacs-W3/2.1.105 URL/1.267 ((Unix?) ; TTY ; sparc-sun-solaris2.3)",
|
364 | |
"2.1",
|
365 | |
2,
|
366 | |
0.1,
|
367 | |
undef,
|
368 | |
"Unix",
|
369 | |
undef,
|
370 | |
["emacs", "sun", "unix"],
|
371 | |
],
|
372 | |
[
|
373 | |
"Mozilla/5.001 (windows; U; NT4.0; en-us) Gecko/25250101",
|
374 | |
"5.001",
|
375 | |
5,
|
376 | |
0.001,
|
377 | |
"Netscape",
|
378 | |
"WinNT",
|
379 | |
undef,
|
380 | |
[
|
381 | |
"netscape",
|
382 | |
"nav4up",
|
383 | |
"nav45up",
|
384 | |
"windows",
|
385 | |
"winnt",
|
386 | |
"win32",
|
387 | |
"gecko",
|
388 | |
"nav6",
|
389 | |
"nav6up",
|
390 | |
"mozilla",
|
391 | |
"gecko",
|
392 | |
],
|
393 | |
],
|
394 | |
[
|
395 | |
"Mozilla/5.001 (Macintosh; N; PPC; ja) Gecko/25250101 MegaCorpBrowser/1.0 (MegaCorp, Inc.)",
|
396 | |
"5.001",
|
397 | |
5,
|
398 | |
0.001,
|
399 | |
"Netscape",
|
400 | |
"Mac",
|
401 | |
undef,
|
402 | |
[
|
403 | |
"netscape",
|
404 | |
"nav4up",
|
405 | |
"nav45up",
|
406 | |
"nav6",
|
407 | |
"nav6up",
|
408 | |
"mac",
|
409 | |
"macppc",
|
410 | |
"mozilla",
|
411 | |
"gecko",
|
412 | |
],
|
413 | |
],
|
414 | |
[
|
415 | |
"Mozilla/9.876 (X11; U; Linux 2.2.12-20 i686, en) Gecko/25250101 Netscape/5.432b1 (C-MindSpring)",
|
416 | |
"5.432",
|
417 | |
5,
|
418 | |
0.432,
|
419 | |
"Netscape",
|
420 | |
"Linux",
|
421 | |
undef,
|
422 | |
[
|
423 | |
"netscape",
|
424 | |
"nav4up",
|
425 | |
"nav45up",
|
426 | |
"nav6",
|
427 | |
"nav6up",
|
428 | |
"linux",
|
429 | |
"unix",
|
430 | |
"mozilla",
|
431 | |
"gecko",
|
432 | |
"x11",
|
433 | |
],
|
434 | |
],
|
435 | |
[
|
436 | |
"TinyBrowser/2.0 (TinyBrowser Comment) Gecko/20201231",
|
437 | |
"2.0",
|
438 | |
2,
|
439 | |
0,
|
440 | |
undef,
|
441 | |
undef,
|
442 | |
undef,
|
443 | |
["gecko"],
|
444 | |
],
|
445 | |
[
|
446 | |
"TinyBrowser/2.0 (TinyBrowser Comment) Gecko/20201231",
|
447 | |
"2.000",
|
448 | |
2,
|
449 | |
0,
|
450 | |
undef,
|
451 | |
undef,
|
452 | |
undef,
|
453 | |
["gecko"],
|
454 | |
],
|
455 | |
[
|
456 | |
"Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7) Gecko/20040619 Firefox/0.9",
|
457 | |
"0.9",
|
458 | |
0,
|
459 | |
0.9,
|
460 | |
"Firefox",
|
461 | |
"Unix",
|
462 | |
"1.7",
|
463 | |
["unix", "freebsd", "bsd", "x11", "firefox", "gecko"],
|
464 | |
],
|
465 | |
[
|
466 | |
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040614 Firefox/0.9",
|
467 | |
"0.9",
|
468 | |
0,
|
469 | |
0.9,
|
470 | |
"Firefox",
|
471 | |
"WinXP",
|
472 | |
"1.7",
|
473 | |
["windows", "win32", "winnt", "winxp", "firefox", "gecko"],
|
474 | |
],
|
475 | |
[
|
476 | |
"Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a) Gecko/20040416 Firefox/0.8.0+",
|
477 | |
"0.8",
|
478 | |
0,
|
479 | |
0.8,
|
480 | |
"Firefox",
|
481 | |
"Win2k",
|
482 | |
"1.8a",
|
483 | |
["windows", "win32", "winnt", "win2k", "firefox", "gecko"],
|
484 | |
],
|
485 | |
[
|
486 | |
"Mozilla/5.0 (X11; U; Linux i686; de-DE; rv:1.6) Gecko/20040207 Firefox/0.8",
|
487 | |
"0.8",
|
488 | |
0,
|
489 | |
0.8,
|
490 | |
"Firefox",
|
491 | |
"Linux",
|
492 | |
"1.6",
|
493 | |
["unix", "linux", "x11", "firefox", "gecko"],
|
494 | |
],
|
495 | |
[
|
496 | |
"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5a) Gecko/20031002 Mozilla Firebird/0.6.1",
|
497 | |
"0.6",
|
498 | |
0,
|
499 | |
0.6,
|
500 | |
"Firefox",
|
501 | |
"Linux",
|
502 | |
"1.5a",
|
503 | |
["unix", "linux", "x11", "firefox", "gecko"],
|
504 | |
],
|
505 | |
[
|
506 | |
"Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.3a) Gecko/20021207 Phoenix/0.5",
|
507 | |
"0.5",
|
508 | |
0,
|
509 | |
0.5,
|
510 | |
"Firefox",
|
511 | |
"WinNT",
|
512 | |
"1.3a",
|
513 | |
["windows", "win32", "winnt", "firefox", "gecko"],
|
514 | |
],
|
515 | |
[
|
516 | |
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; OfficeLive",
|
517 | |
"7.0",
|
518 | |
7,
|
519 | |
0,
|
520 | |
"MSIE",
|
521 | |
"WinVista",
|
522 | |
undef,
|
523 | |
[
|
524 | |
"windows",
|
525 | |
"win32",
|
526 | |
"winnt",
|
527 | |
"winvista",
|
528 | |
"dotnet",
|
529 | |
"ie",
|
530 | |
"ie7",
|
531 | |
"ie4up",
|
532 | |
"ie5up",
|
533 | |
"ie55up",
|
534 | |
],
|
535 | |
],
|
536 | |
[
|
537 | |
"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.31 Safari/530.5",
|
538 | |
"2.0",
|
539 | |
2,
|
540 | |
0,
|
541 | |
"Chrome",
|
542 | |
"WinVista",
|
543 | |
undef,
|
544 | |
[
|
545 | |
"windows",
|
546 | |
"win32",
|
547 | |
"winnt",
|
548 | |
"winvista",
|
549 | |
"chrome",
|
550 | |
],
|
551 | |
[
|
552 | |
"safari",
|
553 | |
"gecko",
|
554 | |
],
|
555 | |
],
|
556 | |
# RT #48727
|
557 | |
[
|
558 | |
"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/530.19.2 (KHTML, like Gecko) Version/4.0.2 Safari/530.19.1",
|
559 | |
"4.0",
|
560 | |
4,
|
561 | |
0,
|
562 | |
"Safari",
|
563 | |
"WinVista",
|
564 | |
undef,
|
565 | |
[
|
566 | |
"windows",
|
567 | |
"win32",
|
568 | |
"winnt",
|
569 | |
"winvista",
|
570 | |
"safari",
|
571 | |
],
|
572 | |
[
|
573 | |
"gecko",
|
574 | |
],
|
575 | |
],
|
576 | |
[
|
577 | |
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/124 (KHTML, like Gecko) Safari/125.1",
|
578 | |
"1.25",
|
579 | |
1,
|
580 | |
0.25,
|
581 | |
"Safari",
|
582 | |
"Mac OS X",
|
583 | |
undef,
|
584 | |
[
|
585 | |
"mac",
|
586 | |
"macosx",
|
587 | |
"macppc",
|
588 | |
"safari",
|
589 | |
],
|
590 | |
[
|
591 | |
"gecko",
|
592 | |
],
|
593 | |
],
|
594 | |
[
|
595 | |
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/106.2 (KHTML, like Gecko) Safari/100.1",
|
596 | |
"1.0",
|
597 | |
1,
|
598 | |
0,
|
599 | |
"Safari",
|
600 | |
"Mac OS X",
|
601 | |
undef,
|
602 | |
[
|
603 | |
"mac",
|
604 | |
"macosx",
|
605 | |
"macppc",
|
606 | |
"safari",
|
607 | |
],
|
608 | |
[
|
609 | |
"gecko",
|
610 | |
],
|
611 | |
],
|
612 | |
[
|
613 | |
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/74 (KHTML, like Gecko) Safari/74",
|
614 | |
"0.74",
|
615 | |
0,
|
616 | |
0.74,
|
617 | |
"Safari",
|
618 | |
"Mac OS X",
|
619 | |
undef,
|
620 | |
[
|
621 | |
"mac",
|
622 | |
"macosx",
|
623 | |
"macppc",
|
624 | |
"safari",
|
625 | |
],
|
626 | |
[
|
627 | |
"gecko",
|
628 | |
],
|
629 | |
],
|
630 | |
[
|
631 | |
"BlackBerry7730/3.7.1 UP.Link/5.1.2.5",
|
632 | |
"3.7",
|
633 | |
3,
|
634 | |
0.7,
|
635 | |
undef,
|
636 | |
undef,
|
637 | |
undef,
|
638 | |
["blackberry"],
|
639 | |
],
|
640 | |
[
|
641 | |
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)",
|
642 | |
"6.0",
|
643 | |
6,
|
644 | |
0,
|
645 | |
"MSIE",
|
646 | |
"Win2k",
|
647 | |
undef,
|
648 | |
[
|
649 | |
"windows",
|
650 | |
"winnt",
|
651 | |
"win2k",
|
652 | |
"win32",
|
653 | |
"ie",
|
654 | |
"ie4up",
|
655 | |
"ie5up",
|
656 | |
"ie55up",
|
657 | |
"ie6",
|
658 | |
"dotnet",
|
659 | |
],
|
660 | |
],
|
661 | |
[
|
662 | |
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)",
|
663 | |
"6.0",
|
664 | |
6,
|
665 | |
0,
|
666 | |
"MSIE",
|
667 | |
"WinXP",
|
668 | |
undef,
|
669 | |
[
|
670 | |
"windows",
|
671 | |
"winnt",
|
672 | |
"winxp",
|
673 | |
"win32",
|
674 | |
"ie",
|
675 | |
"ie4up",
|
676 | |
"ie5up",
|
677 | |
"ie55up",
|
678 | |
"ie6",
|
679 | |
],
|
680 | |
],
|
681 | |
[
|
682 | |
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)",
|
683 | |
"6.0",
|
684 | |
6,
|
685 | |
0,
|
686 | |
"MSIE",
|
687 | |
"WinXP",
|
688 | |
undef,
|
689 | |
[
|
690 | |
"windows",
|
691 | |
"winnt",
|
692 | |
"winxp",
|
693 | |
"win32",
|
694 | |
"ie",
|
695 | |
"ie4up",
|
696 | |
"ie5up",
|
697 | |
"ie55up",
|
698 | |
"ie6",
|
699 | |
"dotnet",
|
700 | |
],
|
701 | |
],
|
702 | |
[
|
703 | |
"Mozilla/4.0 (compatible; MSIE 5.22; Mac_PowerPC) ",
|
704 | |
"5.22",
|
705 | |
5,
|
706 | |
0.22,
|
707 | |
"MSIE",
|
708 | |
"Mac",
|
709 | |
undef,
|
710 | |
["mac", "macppc", "ie", "ie4up", "ie5", "ie5up"],
|
711 | |
],
|
712 | |
[
|
713 | |
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02",
|
714 | |
"7.02",
|
715 | |
7,
|
716 | |
0.02,
|
717 | |
"Netscape",
|
718 | |
"Mac OS X",
|
719 | |
"1.0.2",
|
720 | |
[
|
721 | |
"mac",
|
722 | |
"macppc",
|
723 | |
"netscape",
|
724 | |
"nav4up",
|
725 | |
"nav45up",
|
726 | |
"nav6up",
|
727 | |
"gecko",
|
728 | |
"macosx",
|
729 | |
"mozilla",
|
730 | |
],
|
731 | |
],
|
732 | |
[
|
733 | |
"Mozilla/5.0 (X11; U; Linux 2.4.3-20mdk i586; en-US; rv:0.9.1) Gecko/20010611",
|
734 | |
"5",
|
735 | |
5,
|
736 | |
0,
|
737 | |
"Netscape",
|
738 | |
"Linux",
|
739 | |
"0.9.1",
|
740 | |
[
|
741 | |
"linux",
|
742 | |
"netscape",
|
743 | |
"nav4up",
|
744 | |
"nav45up",
|
745 | |
"nav6",
|
746 | |
"nav6up",
|
747 | |
"unix",
|
748 | |
"x11",
|
749 | |
"gecko",
|
750 | |
"mozilla",
|
751 | |
],
|
752 | |
],
|
753 | |
[
|
754 | |
"Mozilla/5.0 (SymbianOS/9.1; U; en-us) AppleWebKit/413 (KHTML, like Gecko) Safari/413 UP.Link/6.3.1.15.0",
|
755 | |
4.13,
|
756 | |
4,
|
757 | |
0.13,
|
758 | |
"Safari",
|
759 | |
undef,
|
760 | |
undef,
|
761 | |
[
|
762 | |
"safari",
|
763 | |
],
|
764 | |
[
|
765 | |
"gecko",
|
766 | |
],
|
767 | |
],
|
768 | |
[
|
769 | |
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008062901 IceWeasel/3.0",
|
770 | |
3.0,
|
771 | |
3,
|
772 | |
0,
|
773 | |
"Iceweasel",
|
774 | |
undef,
|
775 | |
undef,
|
776 | |
["windows", "win32", "winnt", "winxp", "firefox", "gecko",],
|
777 | |
],
|
778 | |
[
|
779 | |
"libcurl-agent/1.0",
|
780 | |
1,
|
781 | |
1,
|
782 | |
0,
|
783 | |
"curl",
|
784 | |
undef,
|
785 | |
undef,
|
786 | |
["curl"],
|
787 | |
],
|
788 | |
[
|
789 | |
"puf/0.93.2a (Linux 2.4.20-19.9; i686)",
|
790 | |
0.93,
|
791 | |
0,
|
792 | |
0.93,
|
793 | |
"puf",
|
794 | |
undef,
|
795 | |
undef,
|
796 | |
["puf","robot",],
|
797 | |
["mobile",],
|
798 | |
],
|
799 | |
[
|
800 | |
"Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_0_2 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5C1 Safari/525.20",
|
801 | |
undef,
|
802 | |
undef,
|
803 | |
undef,
|
804 | |
"safari",
|
805 | |
undef,
|
806 | |
undef,
|
807 | |
["safari", "mobile"],
|
808 | |
],
|
809 | |
# test for uninitialized value warnings RT #8547
|
810 | |
[
|
811 | |
"Internetf Explorer 6 (MSIE 6; Windows XP)",
|
812 | |
],
|
813 | |
# test for uninitialized value warnings RT #8547
|
814 | |
[
|
815 | |
"Links (2.1pre15; Linux 2.4.26-vc4 i586; x)",
|
816 | |
],
|
817 | |
|
818 | |
# These tests all have issues with returning undef rather than 0 for
|
819 | |
# version numbers. Need to explore this to see what the correct behaviour
|
820 | |
# should be
|
821 | |
|
822 | |
#[
|
823 | |
# "AmigaVoyager (compatible; AmigaVoyager; AmigaOS)",
|
824 | |
# "0.0",
|
825 | |
# 0,
|
826 | |
# 0,
|
827 | |
# undef,
|
828 | |
# undef,
|
829 | |
# undef,
|
830 | |
# ["amiga"],
|
831 | |
#],
|
832 | |
#[
|
833 | |
# "AvantGo 3.2 (compatible; AvantGo 3.2)",
|
834 | |
# "0.0",
|
835 | |
# 0,
|
836 | |
# 0,
|
837 | |
# undef,
|
838 | |
# undef,
|
839 | |
# undef,
|
840 | |
# ["palm", "avantgo"],
|
841 | |
#],
|
842 | |
#["Nothing", undef, undef, 0, undef, undef, undef, [""]], # does this make sense?
|
843 | |
#[undef, "0.0", 0, 0, undef, undef, undef, [""]],
|
844 | |
);
|
845 | |
|
846 | |
|
847 | |
use YAML::Tiny qw( Dump DumpFile );
|
848 | |
|
849 | |
my $string = Dump( @tests );
|
850 | |
#print $string;
|
851 | |
|
852 | |
my @yaml = ( );
|
853 | |
|
854 | |
foreach my $test ( @tests ) {
|
855 | |
my ( $ua, $version, $major, $minor, $browser, $os, $other, $match, $no_match ) = @{$test};
|
856 | |
my $desc = {
|
857 | |
useragent => $ua,
|
858 | |
version => $version,
|
859 | |
major => $major,
|
860 | |
minor => $minor,
|
861 | |
browser => $browser,
|
862 | |
os => $os,
|
863 | |
other => $other,
|
864 | |
match => $match,
|
865 | |
no_match => $no_match,
|
866 | |
};
|
867 | |
|
868 | |
push @yaml, $desc;
|
869 | |
|
870 | |
}
|
871 | |
|
872 | |
my $yaml = Dump ( @yaml );
|
873 | |
|
874 | |
print $yaml;
|
875 | |
|
876 | |
DumpFile( 'useragents.yaml', @yaml );
|