I am using
snap (in combination with
servant and obsidian systems `obelisk) for my web server. In snap I can get the user agent string by reading the approriate header of the request like so:
someHandler :: Snap () someHandler = do -- ... req <- getRequest mStrUserAgent <- getHeader "User-Agent" req case mStrUserAgent of Nothing -> -- handle missing header Just str -> -- do something with the user agent string
For the most simple bot detection, I would then do some sort of lookup in a list of user agent strings of known bots. Does something like this exists in Haskell? My google search didn’t yield any helpful results.
Any advice regarding a starting point for this sort of simple bot detection is very welcome, as well as suggestion for a whole different approach.