robots-txt 0.3.0.0 → 0.3.0.1
raw patch · 2 files changed
+10/−8 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- robots-txt.cabal +1/−1
- src/Network/HTTP/Robots.hs +9/−7
robots-txt.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: robots-txt-version: 0.3.0.0+version: 0.3.0.1 synopsis: Parser for robots.txt description: This is an attoparsec parser for robots.txt files homepage: http://github.com/meanpath/robots
src/Network/HTTP/Robots.hs view
@@ -80,15 +80,17 @@ canAccess agent (robot,_) path = case stanzas of [] -> True ((_,directives):_) -> matchingDirective directives- where stanzas = catMaybes [find ((Literal agent `elem`) . fst) robot,+ where stanzas = catMaybes [find ((any (`isLiteralSubstring` agent)) . fst) robot, find ((Wildcard `elem`) . fst) robot]+++ isLiteralSubstring (Literal a) us = a `BS.isInfixOf` us+ isLiteralSubstring _ _ = False matchingDirective [] = True matchingDirective (x:xs) = case x of- Allow robot_path -> if robot_path `BS.isPrefixOf` path- then True- else matchingDirective xs+ Allow robot_path ->+ robot_path `BS.isPrefixOf` path || matchingDirective xs Disallow robot_path ->- if robot_path `BS.isPrefixOf` path- then False- else matchingDirective xs+ (not $ robot_path `BS.isPrefixOf` path) && matchingDirective xs+ _ -> matchingDirective xs