This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "snap-core".

The branch, 0.5 has been updated
       via  4cf5e61c0362779ace8518e56800375b09aeb8f1 (commit)
      from  6a16a3a3821cd631e7c94b391d902a692f03f401 (commit)


Summary of changes:
 src/Snap/Internal/Types.hs |    9 +++++++++
 src/Snap/Types.hs          |    1 +
 2 files changed, 10 insertions(+), 0 deletions(-)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4cf5e61c0362779ace8518e56800375b09aeb8f1
Author: Mighty Byte <[email protected]>
Date:   Fri Apr 15 20:19:38 2011 -0400

    Implemented readCookie using new Readable infrastructure.

diff --git a/src/Snap/Internal/Types.hs b/src/Snap/Internal/Types.hs
index eb34c34..1a28d62 100644
--- a/src/Snap/Internal/Types.hs
+++ b/src/Snap/Internal/Types.hs
@@ -806,6 +806,15 @@ getCookie name = withRequest $
 
 
 ------------------------------------------------------------------------------
+-- | Gets the HTTP 'Cookie' with the specified name and decodes it.  If the
+-- decoding fails, the handler calls pass.
+readCookie :: (MonadSnap m, Readable a)
+           => ByteString
+           -> m a
+readCookie name = maybe pass (fromBS . cookieValue) =<< getCookie name
+
+
+------------------------------------------------------------------------------
 -- | Causes the handler thread to be killed @n@ seconds from now.
 setTimeout :: MonadSnap m
            => Int -> m ()
diff --git a/src/Snap/Types.hs b/src/Snap/Types.hs
index f40d2c2..e368f24 100644
--- a/src/Snap/Types.hs
+++ b/src/Snap/Types.hs
@@ -104,6 +104,7 @@ module Snap.Types
   , deleteResponseCookie
   , modifyResponseCookie
   , getCookie
+  , readCookie
   , setContentLength
   , clearContentLength
   , redirect
-----------------------------------------------------------------------


hooks/post-receive
-- 
snap-core
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to