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  81db7f64db0b8462b255880322445af49993cd02 (commit)
      from  0e3e863f378bfa187d5fc480968711bfe9b69911 (commit)


Summary of changes:
 src/Snap/Iteratee.hs |   25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 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 81db7f64db0b8462b255880322445af49993cd02
Author: Gregory Collins <[email protected]>
Date:   Tue Jun 1 21:49:37 2010 -0400

    Fix iteratee buffering EOF bug

diff --git a/src/Snap/Iteratee.hs b/src/Snap/Iteratee.hs
index 6b7ecf0..718f0b0 100644
--- a/src/Snap/Iteratee.hs
+++ b/src/Snap/Iteratee.hs
@@ -146,15 +146,15 @@ bufferIteratee iteratee = do
     go (!dl,!n) iter = IterateeG $! f (dl,n) iter
 
     --f :: (DList ByteString, Int) -> Iteratee m a -> Stream -> m (IterV m a)
-    f _      !iter ch@(EOF (Just _)) = runIter iter ch
-    f (!dl,_) !iter ch@(EOF Nothing) = do
-        iterv <- runIter iter $ Chunk big
-        case iterv of
-          Done x rest     -> return $ Done x rest
-          Cont i (Just e) -> return $ Cont i (Just e)
-          Cont i Nothing  -> runIter i ch
+    f _       !iter ch@(EOF (Just _)) = runIter iter ch
+    f (!dl,_) !iter ch@(EOF Nothing)  = do
+        iter' <- if S.null str
+                   then return iter
+                   else liftM liftI $ runIter iter $ Chunk big
+        runIter iter' ch
       where
-        big = toWrap $ L.fromChunks [S.concat $ D.toList dl]
+        str = S.concat $ D.toList dl
+        big = WrapBS str
 
     f (!dl,!n) iter (Chunk (WrapBS s)) =
         if n' > blocksize
@@ -169,7 +169,7 @@ bufferIteratee iteratee = do
         m   = S.length s
         n'  = n+m
         dl' = D.snoc dl s
-        big = toWrap $ L.fromChunks [S.concat $ D.toList dl']
+        big = WrapBS $ S.concat $ D.toList dl'
 
 
 bUFSIZ :: Int
@@ -244,11 +244,8 @@ unsafeBufferIterateeWithBuffer buf iteratee = do
         if n == 0
           then runIter iter ch
           else do
-              iterv <- sendBuf n iter
-              case iterv of
-                Done x rest     -> return $ Done x $ copy rest
-                Cont i (Just e) -> return $ Cont i (Just e)
-                Cont i Nothing  -> runIter i ch
+              iter' <- liftM liftI $ sendBuf n iter
+              runIter iter' ch
 
     f !n iter (Chunk (WrapBS s)) = do
         let m = S.length s
-----------------------------------------------------------------------


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

Reply via email to