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-server".

The branch, master has been updated
       via  ad062e86ac17416d67a1fb0a5aa129b8633d9e70 (commit)
       via  ef67471ed50a9afb288bbf723e818268ff136325 (commit)
      from  70a361063c2be0fde29e0f4f5759348f674b3b15 (commit)


Summary of changes:
 snap-server.cabal                |    2 +-
 src/Snap/Internal/Http/Parser.hs |   19 ++++++++++++++-----
 2 files changed, 15 insertions(+), 6 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 ad062e86ac17416d67a1fb0a5aa129b8633d9e70
Author: Gregory Collins <[email protected]>
Date:   Mon May 24 08:39:18 2010 -0400

    Bump trunk version #

diff --git a/snap-server.cabal b/snap-server.cabal
index 11a3ed3..7193fec 100644
--- a/snap-server.cabal
+++ b/snap-server.cabal
@@ -1,5 +1,5 @@
 name:           snap-server
-version:        0.2.2
+version:        0.2.3
 synopsis:       A fast, iteratee-based, epoll-enabled web server for the Snap 
Framework
 description:
   This is the first developer prerelease of the Snap framework.  Snap is a
commit ef67471ed50a9afb288bbf723e818268ff136325
Author: Gregory Collins <[email protected]>
Date:   Mon May 24 08:38:21 2010 -0400

    Fix one performance and one correctness bug w/ chunked transfer encoding

diff --git a/src/Snap/Internal/Http/Parser.hs b/src/Snap/Internal/Http/Parser.hs
index c687096..c4153cd 100644
--- a/src/Snap/Internal/Http/Parser.hs
+++ b/src/Snap/Internal/Http/Parser.hs
@@ -30,6 +30,7 @@ import qualified Data.ByteString.Nums.Careless.Hex as Cvt
 import           Data.Char
 import           Data.List (foldl')
 import           Data.Int
+import           Data.Iteratee.WrappedByteString
 import           Data.Map (Map)
 import qualified Data.Map as Map
 import           Data.Maybe (catMaybes)
@@ -97,6 +98,8 @@ toHex !i' = S.reverse s
 -- | Given an iteratee, produces a new one that wraps chunks sent to it with a
 -- chunked transfer-encoding. Example usage:
 --
+-- FIXME: sample output no longer looks like this, we buffer now
+--
 -- > > (writeChunkedTransferEncoding
 -- >     (enumLBS (L.fromChunks ["foo","bar","quux"]))
 -- >     stream2stream) >>=
@@ -107,7 +110,8 @@ toHex !i' = S.reverse s
 --
 writeChunkedTransferEncoding :: (Monad m) => Enumerator m a -> Enumerator m a
 writeChunkedTransferEncoding enum it = do
-    i <- wrap it
+    i' <- wrap it
+    i  <- bufferIteratee i'
     enum i
 
   where
@@ -121,13 +125,18 @@ writeChunkedTransferEncoding enum it = do
           (Chunk x') -> do
               let x = S.concat $ L.toChunks $ fromWrap x'
               let n = S.length x
-              let o = L.fromChunks [ toHex (toEnum n)
+              if n == 0
+                then do
+                    i' <- wrap iter
+                    return $ Cont i' Nothing
+                else do
+                  let o = S.concat [ toHex (toEnum n)
                                    , "\r\n"
                                    , x
                                    , "\r\n" ]
-              v <- runIter iter (Chunk $ toWrap o)
-              i <- checkIfDone wrap v
-              return $ Cont i Nothing
+                  v <- runIter iter (Chunk $ WrapBS o)
+                  i <- checkIfDone wrap v
+                  return $ Cont i Nothing
 
 
 chunkParserToEnumerator :: (Monad m) =>
-----------------------------------------------------------------------


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

Reply via email to