10000 GitHub - viadeo/agent212: A small Ruby library to handle HTTP user agent fields
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

viadeo/agent212

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Agent 212

Agent 212 is a small Ruby library to handle HTTP user agent fields.

It splits a user agent field in parts according to the grammar from RFC2616.

It does not try to detect browsers (in the sense of browser sniffing) but if you write some code around it you can use it for this purpose. If this is what you want to do you might want to take a look at https://github.com/kevinelliott/agent_orange .

Examples

user_agent = Agent212.parse(user_agent_string)
if cfnetwork = user_agent.products.detect { |p| p.name == "CFNetwork" }
  if cfnetwork.version != 520.4.3
    raise Foo, 'someone set us up the bomb!'
  else
    puts 'bar'
  end
end

For more examples see: parser_spec line 51 and line 72.

About the name

http://en.wikipedia.org/wiki/Agent_212

About

A small Ruby library to handle HTTP user agent fields

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages

0