lib/woothee/misc.rb in woothee-0.3.0 vs lib/woothee/misc.rb in woothee-0.3.2
- old
+ new
@@ -30,32 +30,36 @@
false
end
def self.challenge_http_library(ua, result)
data,version = case
- when ua =~ /^(?:Apache-HttpClient\/|Jakarta Commons-HttpClient\/|Java\/)/o
+ when ua =~ /^(?:Apache-HttpClient\/|Jakarta Commons-HttpClient\/|Java\/)/o || ua =~ /[- ]HttpClient(\/|$)/o
[Woothee::DataSet.get('HTTPLibrary'), 'Java']
+ when ua.index('Java(TM) 2 Runtime Environment,')
+ [Woothee::DataSet.get('HTTPLibrary'), 'Java']
when ua =~ /^Wget/o
[Woothee::DataSet.get('HTTPLibrary'), 'wget']
when ua =~ /^(?:libwww-perl|WWW-Mechanize|LWP::Simple|LWP |lwp-trivial)/o
[Woothee::DataSet.get('HTTPLibrary'), 'perl']
- when ua =~ /^Python-urllib\//o
+ when ua =~ /^(?:Ruby|feedzirra|Typhoeus)/o
+ [Woothee::DataSet.get('HTTPLibrary'), 'ruby']
+ when ua =~ /^(Python-urllib\/|Twisted )/o
[Woothee::DataSet.get('HTTPLibrary'), 'python']
- when ua =~ /^(:?PHP\/|WordPress\/|CakePHP|PukiWiki\/)/o
+ when ua =~ /^(?:PHP|WordPress|CakePHP|PukiWiki|PECL::HTTP)(?:\/| |$)/o || ua =~ /(?:PEAR |)HTTP_Request(?: class|2)/o
[Woothee::DataSet.get('HTTPLibrary'), 'php']
- when ua.index('PEAR HTTP_Request class;')
- [Woothee::DataSet.get('HTTPLibrary'), 'php']
else [nil,nil]
end
return false unless data
update_map(result, data)
update_version(result, version)
true
end
def self.challenge_maybe_rss_reader(ua, result)
- data = if ua =~ /rss(?:reader|bar|[-_ \/;()])/oi
+ data = if ua =~ /rss(?:reader|bar|[-_ \/;()]|[ +]*\/)/oi || ua =~ /headline-reader/oi
+ Woothee::DataSet.get('VariousRSSReader')
+ elsif ua.index('cococ/')
Woothee::DataSet.get('VariousRSSReader')
else
nil
end
return false unless data