http-trace 0.1.0.0 → 0.1.0.1
raw patch · 2 files changed
+18/−10 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- http-trace.cabal +2/−3
- src/Http/Trace.hs +16/−7
http-trace.cabal view
@@ -1,7 +1,7 @@ name: http-trace-version: 0.1.0.0+version: 0.1.0.1 synopsis: Tracking http redirects -description: Please see README.md+description: Tracking http redirects for supplied url homepage: https://github.com/sigrlami/http-trace#readme license: MIT license-file: LICENSE@@ -11,7 +11,6 @@ category: Web build-type: Simple cabal-version: >=1.10- library hs-source-dirs: src
src/Http/Trace.hs view
@@ -24,14 +24,19 @@ fullUrlRegex :: Regex fullUrlRegex = [re|(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?|] +-- | Regex for getting top-level web link from text+-- shortUrlRegex :: Regex shortUrlRegex = [re|(http|https)?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}|] userAgent = "" -- | Function to get all redirects for--- provided url-traceRedirects :: String -> IO [String]+-- provided url in form of full link+-- Search throught LOCATION meta, head+-- and body tags+traceRedirects :: String -- ^ Starting url+ -> IO [String] -- ^ List of available redirects traceRedirects start = traceAux start where@@ -59,9 +64,12 @@ Nothing -> return $ "" Just link -> return $ fst link --- | Version that returns top-level domain names--- without full url path -traceRedirects' :: String -> Bool -> IO [String]+-- | Alternative to `traceRedrects` that returns top-level domain names+-- without full url path. With compress functionality can show only+-- distinct domains without repetition. +traceRedirects' :: String -- ^ Starting url+ -> Bool -- ^ Flag to remove duplicate domains+ -> IO [String] -- ^ List of available redirects traceRedirects' start compress = do rdrs <- traceRedirects start let rdrs' = map (\x -> fst $ head $ scan shortUrlRegex x) rdrs@@ -74,7 +82,7 @@ -- traceRedirectsWithType -- usually click/jump/track/badlink --- | Check if we redirects paths lead to destination url+-- | Checks if we redirects paths lead to destination url -- isReachable :: String -> String -> IO Bool isReachable start dest =@@ -84,7 +92,8 @@ True -> return $ False False -> return $ last redirects == dest -+--------------------------------------------------------------------------------+ removeDuplicates :: Eq a => [a] -> [a] removeDuplicates = rdHelper [] where rdHelper seen [] = seen