我从http://www.user-agents.org/下载了所有用户代理,并运行了一个脚本以计算使用+
样式链接与普通链接的数量。我排除了与RFC 2616不匹配的“非标准”用户代理字符串。
结果如下:
Total: 2471
Standard: 2064
Non-standard: 407
No link: 1391
With link: 673
Plus link: 145
Plain link: 528
Plus link only: 86
Plain link only: 174
因此,在673个包含链接的用户代理中,只有21%包含正号。在260个仅具有链接注释的用户代理中,只有33%包含加号。
根据此分析,加号很常见,但是大多数用户代理选择不使用它。可以省略它,但是将它包含进来也很常见。
如果您想自己运行它,这是执行此分析的Perl脚本。
#!/usr/bin/perl
use strict;
my $doc="";
while(my $line = <>){
$doc.=$line;
}
my @agents = $doc =~ /\<td class\=\"left\"\>[ \t\r\n]+(.*?)\ \;/gs;
my $total = 0;
my $standard = 0;
my $nonStandard = 0;
my $noHttp = 0;
my $http = 0;
my $plusHttp = 0;
my $noPlusHttp = 0;
my $linkOnly = 0;
my $plusLinkOnly = 0;
for my $agent (@agents){
$total++;
if ($agent =~ /^(?:[a-zA-Z0-9\.\-\_]+(?:\/[a-zA-Z0-9\.\-\_]+)?(?: \([^\)]+\))?[ ]*)+$/){
print "Standard: $agent\n";
$standard++;
if ($agent =~ /http/i){
print "With link: $agent\n";
$http++;
if ($agent =~ /\+http/i){
print "Plus link: $agent\n";
$plusHttp++;
} else {
print "Plain link: $agent\n";
$noPlusHttp++;
}
if ($agent =~ /\(http[^ ]+\)/i){
print "Plain link only: $agent\n";
$linkOnly++;
} elsif ($agent =~ /\(\+http[^ ]+\)/i){
print "Plus link only: $agent\n";
$plusLinkOnly++;
}
} else {
print "No link: $agent\n";
$noHttp++;
}
} else {
print "Non-standard: $agent\n";
$nonStandard++;
}
}
print "
Total: $total
Standard: $standard
Non-standard: $nonStandard
No link: $noHttp
With link: $http
Plus link: $plusHttp
Plain link: $noPlusHttp
Plus link only: $plusLinkOnly
Plain link only: $linkOnly
";