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, enumerator has been updated
       via  8c9b7098751784b9d88dff68524ed2558c03c3d8 (commit)
      from  342c8670430548936a367d5568983ea1f28d144a (commit)


Summary of changes:
 src/Snap/Iteratee.hs |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 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 8c9b7098751784b9d88dff68524ed2558c03c3d8
Author: Gregory Collins <[email protected]>
Date:   Sat Dec 4 12:34:45 2010 +0100

    Fix a bug in Iteratee.take

diff --git a/src/Snap/Iteratee.hs b/src/Snap/Iteratee.hs
index 8148628..b32ee74 100644
--- a/src/Snap/Iteratee.hs
+++ b/src/Snap/Iteratee.hs
@@ -412,10 +412,13 @@ take' :: (Monad m) => Int64 -> Enumeratee ByteString 
ByteString m a
 take' _ y@(Yield _ _   ) = return y
 take' _   (Error e     ) = throwError e
 take' !n st@(Continue k) = do
-    mbX <- head
-    maybe (lift $ runIteratee $ k EOF)
-          check
-          mbX
+    if n == 0
+      then lift $ runIteratee $ k EOF
+      else do
+        mbX <- head
+        maybe (lift $ runIteratee $ k EOF)
+              check
+              mbX
 
   where
     check x | S.null x    = take' n st
@@ -452,10 +455,13 @@ takeExactly 0   s = do
 takeExactly !n  y@(Yield _ _ ) = drop' n >> return y
 takeExactly _     (Error e   ) = throwError e
 takeExactly !n st@(Continue k) = do
-    mbX <- head
-    maybe (throwError ShortWriteException)
-          check
-          mbX
+    if n == 0
+      then lift $ runIteratee $ k EOF
+      else do
+        mbX <- head
+        maybe (throwError ShortWriteException)
+              check
+              mbX
 
   where
     check x | S.null x   = takeExactly n st
-----------------------------------------------------------------------


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

Reply via email to