packages feed

https-everywhere-rules 0.0.1 → 0.0.2

raw patch · 3 files changed

+11/−12 lines, 3 filesdep ~text-icuPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: text-icu

API changes (from Hackage documentation)

- Data.HTTPSEverywhere.Rules: rewriteURL :: URI -> IO (Maybe URI)
+ Data.HTTPSEverywhere.Rules: rewriteURL :: URI -> IO URI

Files

README.md view
@@ -11,13 +11,11 @@ λ: :m + Data.HTTPSEverywhere.Rules Network.URI λ: let Just eff = parseURI "http://www.eff.org/document/eff-and-aclu-amicus-brief-klayman" λ: rewriteURL eff-Just https://www.eff.org/document/eff-and-aclu-amicus-brief-klayman-λ: :m + Web.Cookie Network.HTTP.Client Data.Time.Clock Control.Applicative-λ: :set -XOverloadedStrings-λ: (now, req) <- (,) <$> getCurrentTime <*> parseUrl "https://github.com"-λ: let (Just gh, Just ck) = (parseURI "https://github.com", generateCookie (def{setCookieDomain=Just "github.com"}) req now True)-λ: rewriteCookie gh ck-Cookie {cookie_name = "name", cookie_value = "value", cookie_expiry_time = 3013-12-25 00:00:00 UTC, cookie_domain = "github.com", cookie_path = "/", cookie_creation_time = 2014-08-24 05:58:20.691866 UTC, cookie_last_access_time = 2014-08-24 05:58:20.691866 UTC, cookie_persistent = False, cookie_host_only = False, cookie_secure_only = True, cookie_http_only = False}+https://www.eff.org/document/eff-and-aclu-amicus-brief-klayman+λ: :m + Network.HTTP.Client Network.HTTP.Client.TLS Control.Applicative Control.Lens+λ: (req, hub) <- (,) <*> getUri <$> parseUrl "https://github.com/fmap/https-everywhere-rules"+λ: newManager tlsManagerSettings >>= httpNoBody req <&> destroyCookieJar . responseCookieJar >>= mapM (rewriteCookie hub)+[Cookie {cookie_name = "_gh_sess", cookie_value = "eyJzZXNzaW9uX2lkIjoiNjBlM2FiOTIxNTdhZTNhNDE5YWQ0ZTk4ZWQzNDRjMjEiLCJzcHlfcmVwbyI6ImZtYXAvaHR0cHMtZXZlcnl3aGVyZS1ydWxlcyIsInNweV9yZXBvX2F0IjoxNDA4ODk2OTM2LCJfY3NyZl90b2tlbiI6IktkbTlwN2JqNGptVmhrYjFIUm9BbkV0a1JTQXRDUXJid2g4VWo4N1g0Q1U9In0%3D--d378daa262b8c12bb82246d5de6b3adc353a3db7", cookie_expiry_time = 3013-12-25 00:00:00 UTC, cookie_domain = "github.com", cookie_path = "/", cookie_creation_time = 2014-08-24 16:15:37.815144 UTC, cookie_last_access_time = 2014-08-24 16:15:37.815144 UTC, cookie_persistent = False, cookie_host_only = True, cookie_secure_only = True, cookie_http_only = True},Cookie {cookie_name = "logged_in", cookie_value = "no", cookie_expiry_time = 2034-08-24 16:15:36 UTC, cookie_domain = "github.com", cookie_path = "/", cookie_creation_time = 2014-08-24 16:15:37.815144 UTC, cookie_last_access_time = 2014-08-24 16:15:37.815144 UTC, cookie_persistent = True, cookie_host_only = False, cookie_secure_only = True, cookie_http_only = True}] ```  Rules are provided via [`https-everywhere-rules-raw`][2], which is
https-everywhere-rules.cabal view
@@ -1,7 +1,7 @@ name:   https-everywhere-rules version:-  0.0.1+  0.0.2 synopsis:   High-level access to HTTPS Everywhere rulesets. homepage:@@ -43,7 +43,7 @@     string-conversions >= 0.3  && < 0.4,     taggy-lens         >= 0.1  && < 0.2,     text               >= 1.1  && < 1.2,-    text-icu           >= 0.6  && < 0.7,+    text-icu           >= 0.6  && < 0.8,     https-everywhere-rules-raw   hs-source-dirs:     src@@ -68,7 +68,7 @@     string-conversions >= 0.3  && < 0.4,     taggy-lens         >= 0.1  && < 0.2,     text               >= 1.1  && < 1.2,-    text-icu           >= 0.6  && < 0.7,+    text-icu           >= 0.6  && < 0.8,     https-everywhere-rules-raw   main-is:     Spec.hs
src/Data/HTTPSEverywhere/Rules.hs view
@@ -6,6 +6,7 @@ import Prelude hiding (null, head) import Control.Lens ((<&>),(&)) import Data.Bool (bool)+import Data.Maybe (fromMaybe) import Network.HTTP.Client (Cookie) import Network.URI (URI) import Pipes ((>->))@@ -13,8 +14,8 @@ import Control.Monad (join) import Data.HTTPSEverywhere.Rules.Internal (getRulesetsMatching, havingRulesThatTrigger, havingCookieRulesThatTrigger, setSecureFlag) -rewriteURL :: URI -> IO (Maybe URI)-rewriteURL url = getRulesetsMatching url >-> havingRulesThatTrigger url & head <&> join+rewriteURL :: URI -> IO URI+rewriteURL url = getRulesetsMatching url >-> havingRulesThatTrigger url & head <&> fromMaybe url . join  rewriteCookie :: URI -> Cookie -> IO Cookie rewriteCookie url cookie = null producer <&> setSecureFlag cookie `bool` cookie