Class: HttpHelper
- Inherits:
-
Object
- Object
- HttpHelper
- Defined in:
- lib/gl_tail/http_helper.rb
Overview
gl_tail.rb - OpenGL visualization of your server traffic Copyright 2007 Erlend Simonsen <[email protected]>
Licensed under the GNU General Public License v2 (see LICENSE)
Class Method Summary collapse
Class Method Details
.generalize_url(url) ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/gl_tail/http_helper.rb', line 47 def self.generalize_url(url) case url when /^(.*?)\/(\d+)$/ "#{$1}/:id" when /^(.*?)\/[a-zA-Z0-9]{32}(.*?)$/ "#{$1}/:md5#{$2 if $2}" else url end end |
.parse_useragent(ua) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/gl_tail/http_helper.rb', line 9 def self.parse_useragent(ua) case ua when /MSIE ([^;]+);/ "Internet Explorer #{$1}" when /Firefox\/(\S+)/ "Firefox #{$1}" when /Iceweasel\/(\S+)/ "Firefox #{$1}" when /Camino\/(\S+)/ "Camino #{$1}" when /Opera\/(\S+)/ "Opera #{$1}" when /Safari\/([\d.]+)/ "Safari #{$1}" when /Konqueror\/(\S+);/ "Konqueror #{$1}" when /Wget/ 'Wget' when /ia_archiver/ "Internet Archive Bot" when /Googlebot/ "Google Bot" when /msnbot-media/ "Microsoft Media Bot" when /msnbot/ "Microsoft Bot" when /Gigabot/ 'Gigabot' when /Yahoo!/ 'Yahoo Bot' when "-" "-" else ua end end |