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, master has been updated
via 6dc149cd34142785d1460a757b219008a9d16fe6 (commit)
from ec9eba8576f356def7d8fbf6b2c8c665c74f1355 (commit)
Summary of changes:
src/Snap/Internal/Http/Types.hs | 6 ++++++
src/Snap/Types.hs | 1 +
test/suite/Snap/Types/Tests.hs | 4 +++-
3 files changed, 10 insertions(+), 1 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 6dc149cd34142785d1460a757b219008a9d16fe6
Author: Gregory Collins <[email protected]>
Date: Fri Sep 24 18:04:51 2010 -0400
Add 'deleteHeader' function
diff --git a/src/Snap/Internal/Http/Types.hs b/src/Snap/Internal/Http/Types.hs
index 98168f4..66016d0 100644
--- a/src/Snap/Internal/Http/Types.hs
+++ b/src/Snap/Internal/Http/Types.hs
@@ -126,6 +126,12 @@ getHeader k a = liftM (S.intercalate " ") (Map.lookup k $
headers a)
------------------------------------------------------------------------------
+-- | Clears a header value from a 'HasHeaders' datatype.
+deleteHeader :: (HasHeaders a) => CIByteString -> a -> a
+deleteHeader k = updateHeaders $ Map.delete k
+
+
+------------------------------------------------------------------------------
-- | Enumerates the HTTP method values (see
-- <http://tools.ietf.org/html/rfc2068.html#section-5.1.1>).
data Method = GET | HEAD | POST | PUT | DELETE | TRACE | OPTIONS | CONNECT
diff --git a/src/Snap/Types.hs b/src/Snap/Types.hs
index 1a47f9e..bf18d4b 100644
--- a/src/Snap/Types.hs
+++ b/src/Snap/Types.hs
@@ -58,6 +58,7 @@ module Snap.Types
, addHeader
, setHeader
, getHeader
+ , deleteHeader
, ipHeaderFilter
, ipHeaderFilter'
diff --git a/test/suite/Snap/Types/Tests.hs b/test/suite/Snap/Types/Tests.hs
index 8cdcd6a..3b9d8fa 100644
--- a/test/suite/Snap/Types/Tests.hs
+++ b/test/suite/Snap/Types/Tests.hs
@@ -105,7 +105,9 @@ mkZomgRq = do
mkIpHeaderRq :: IO Request
mkIpHeaderRq = do
rq <- mkZomgRq
- return $ setHeader "X-Forwarded-For" "1.2.3.4" rq
+ return $ setHeader "X-Forwarded-For" "1.2.3.4"
+ $ deleteHeader "X-Forwarded-For"
+ $ setHeader "X-Forwarded-For" "1.2.3.4" rq
mkRqWithBody :: IO Request
-----------------------------------------------------------------------
hooks/post-receive
--
snap-core
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap