From d75478773fd09ef8f20b4e451a46e188ad29b7e6 Mon Sep 17 00:00:00 2001 From: vi Date: Sun, 24 Aug 2014 14:00:41 +0800 Subject: [PATCH] Added cookie example to README. --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 36fca84..a600c3e 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,12 @@ used secure HTTP connections when possible." λ: 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} ``` [1]: https://www.eff.org/https-everywhere