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  2b9c9ec1a5b000654ff1d2dec7b6cc881c8ddd52 (commit)
      from  0a293ae9e681ae5dcb179839a929a1e816b910c5 (commit)


Summary of changes:
 src/Snap/Internal/Http/Types.hs |    6 +++++-
 src/Snap/Internal/Types.hs      |    7 ++++++-
 2 files changed, 11 insertions(+), 2 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 2b9c9ec1a5b000654ff1d2dec7b6cc881c8ddd52
Author: Gregory Collins <[email protected]>
Date:   Thu Sep 9 17:16:58 2010 -0400

    Add a field to Response so we can tell whether we detached the request body 
enumerator or not

diff --git a/src/Snap/Internal/Http/Types.hs b/src/Snap/Internal/Http/Types.hs
index f766230..ad8a22a 100644
--- a/src/Snap/Internal/Http/Types.hs
+++ b/src/Snap/Internal/Http/Types.hs
@@ -379,6 +379,9 @@ data Response = Response
 
       -- | Returns the HTTP status explanation string.
     , rspStatusReason  :: !ByteString
+
+      -- | If true, we detached the request body with 'unsafeDetachRequestBody'
+    , rspDetachedBody  :: !Bool
     }
 
 
@@ -448,7 +451,8 @@ rqSetParam k v = rqModifyParams $ Map.insert k v
 
 -- | An empty 'Response'.
 emptyResponse       :: Response
-emptyResponse       = Response Map.empty (1,1) Nothing (Enum return) 200 "OK"
+emptyResponse       = Response Map.empty (1,1) Nothing (Enum return) 200
+                               "OK" False
 
 
 ------------------------------------------------------------------------------
diff --git a/src/Snap/Internal/Types.hs b/src/Snap/Internal/Types.hs
index 4c21092..6e11b22 100644
--- a/src/Snap/Internal/Types.hs
+++ b/src/Snap/Internal/Types.hs
@@ -27,6 +27,7 @@ import           Data.Typeable
 ------------------------------------------------------------------------------
 import           Snap.Iteratee hiding (Enumerator)
 import           Snap.Internal.Http.Types
+import           Snap.Internal.Debug
 import           Snap.Internal.Iteratee.Debug
 
 
@@ -219,8 +220,12 @@ unsafeDetachRequestBody = do
     let (SomeEnumerator enum) = senum
     liftIO $ writeIORef ioref
                (SomeEnumerator $ return . Iter.joinI . Iter.take 0)
+
+    modifyResponse $ \rsp -> rsp { rspDetachedBody = True }
+
     return $ SomeEnumerator
-           $ \i -> enum (iterateeDebugWrapper "unsafeDetachRequestBody" i)
+           $ \i -> enum $
+                   iterateeDebugWrapper "unsafeDetachRequestBody" i
 
 
 ------------------------------------------------------------------------------
-----------------------------------------------------------------------


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

Reply via email to