Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the HTTP-BrowserDetect CPAN distribution.

Report information
The Basics
Id: 12259
Status: resolved
Priority: 0/
Queue: HTTP-BrowserDetect

People
Owner: Nobody in particular
Requestors: gerryster [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.98
Fixed in: (no value)



Subject: Version not detected in netscape 6
Netscape 6 version is not correctly detected. For example: Output expected: 6 Actual output: 0 perl -MHTTP::Browserdetect -e '$a = new HTTP::BrowserDetect("Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.2) Gecko/20010726 Netscape6/6.1"); print $a->version' Notice that at the end of the ua string it has Netscape6 instead of Netscape. I beleive this is a real user agent string found in the wild. I have more examples if needed. I am using HTTP::BrowserDetect .98. Here is the standard perl and os info: perl -v This is perl, v5.8.1-RC3 built for darwin-thread-multi-2level My OS is Mac OS 10.3.8.
From: gerryster [...] gmail.com
I am planning on submitting a patch for this issue shortly. RG
Attached is a patch that addresses the netscape6 issue. I changed the netscape regex and netscape6 logic in Broswerdetect.pm. There is also another test case in test.pl. Examples of this netscape6 header can also be seen on http://www.zytrax.com/tech/web/browser_ids.htm .
# This is a patch for HTTP-BrowserDetect-0.98 to update it to HTTP-BrowserDetect-0.98-rt12259 # # To apply this patch: # STEP 1: Chdir to the source directory. # STEP 2: Run the 'applypatch' program with this patch file as input. # # If you do not have 'applypatch', it is part of the 'makepatch' package # that you can fetch from the Comprehensive Perl Archive Network: # http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz # In the above URL, 'x' should be 2 or higher. # # To apply this patch without the use of 'applypatch': # STEP 1: Chdir to the source directory. # STEP 2: Run the 'patch' program with this file as input. # #### End of Preamble #### #### Patch data follows #### diff -u 'HTTP-BrowserDetect-0.98/BrowserDetect.pm' 'HTTP-BrowserDetect-0.98-rt12259/BrowserDetect.pm' Index: ./BrowserDetect.pm --- ./BrowserDetect.pm Mon Jun 21 23:36:47 2004 +++ ./BrowserDetect.pm Fri May 20 17:52:21 2005 @@ -155,7 +155,7 @@ if ($tests->{GECKO} && $tests->{NETSCAPE} && index($ua,"netscape")!=-1) { ($major, $minor, $beta) = ($ua =~ / - netscape\/ + netscape6?\/ # browser string sometimes ends in 6 for version 6 ( [^\.]* ) # Major version number is everything before first dot \. # The first dot ( [\d]* ) # Minor version nnumber is digits after first dot @@ -174,7 +174,7 @@ $tests->{NAV45} = ($tests->{NETSCAPE} && $major == 4 && $minor == .5); $tests->{NAV45UP} = ($tests->{NAV4} && $minor >= .5) || ($tests->{NETSCAPE} && $major >= 5); $tests->{NAVGOLD} = (index($beta,"gold") != -1); - $tests->{NAV6} = ($tests->{NETSCAPE} && $major == 5); # go figure + $tests->{NAV6} = ($tests->{NETSCAPE} && ( $major == 5 || $major == 6 )); # go figure $tests->{NAV6UP} = ($tests->{NETSCAPE} && $major >= 5); $tests->{MOZILLA} = ($tests->{NETSCAPE} && $tests->{GECKO}); @@ -660,7 +660,7 @@ java curl -Netscape 6, even though its called six, in the userAgent string has version number 5. The nav6 and nav6up methods correctly handle this quirk. +Netscape 6, even though its called six, sometimes in the userAgent string has version number 5. The nav6 and nav6up methods correctly handle this quirk. The firefox text correctly detects the older-named versions of the browser (Phoenix, Firebird) =over diff -u 'HTTP-BrowserDetect-0.98/test.pl' 'HTTP-BrowserDetect-0.98-rt12259/test.pl' Index: ./test.pl --- ./test.pl Mon Jun 21 23:34:15 2004 +++ ./test.pl Tue Apr 26 08:05:28 2005 @@ -166,6 +166,11 @@ 'Linux', '0.9.1',qw(linux netscape nav4up nav45up nav6 nav6up unix x11 gecko mozilla)], + ['Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.2) Gecko/20010726 Netscape6/6.1', + '6.1', + 'Netscape', + 'Win98', + '0.9.2',qw(windows win32 win98 netscape nav4up nav45up nav6 nav6up mozilla gecko)], ); #### End of Patch data #### #### ApplyPatch data follows #### # Data version : 1.0 # Date generated : Fri May 20 23:22:33 2005 # Generated by : makepatch 2.00 # Recurse directories : Yes # p 'BrowserDetect.pm' 24684 1116629541 0100644 # p 'test.pl' 10786 1114520728 0100644 #### End of ApplyPatch data #### #### End of Patch kit [created: Fri May 20 23:22:33 2005] #### #### Checksum: 77 3313 52821 ####
On Sat May 21 00:27:41 2005, guest wrote: Show quoted text
> Attached is a patch that addresses the netscape6 issue. I changed the > netscape regex and netscape6 logic in Broswerdetect.pm. There is also > another test case in test.pl. Examples of this netscape6 header can > also be seen on http://www.zytrax.com/tech/web/browser_ids.htm . > >
Thanks very much for your patch. It has been applied and will appear in 1.04 Thanks! Olaf