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, 0.2-stable has been updated
       via  e0cbc0abaf371c9174f3fda676ca73a6dd95dd1f (commit)
      from  c45800c70724ae71bc86072162878314c2f21591 (commit)


Summary of changes:
 snap-server.cabal                              |    4 ++--
 src/Snap/Internal/Http/Server.hs               |   12 ++++++++----
 src/Snap/Internal/Http/Server/SimpleBackend.hs |    6 ++++++
 test/common/Test/Common/TestHandler.hs         |    3 ++-
 test/pongserver/Main.hs                        |    7 ++++---
 5 files changed, 22 insertions(+), 10 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 e0cbc0abaf371c9174f3fda676ca73a6dd95dd1f
Author: Gregory Collins <[email protected]>
Date:   Sun Oct 10 19:10:25 2010 +0200

    When http/1.0 and connection: close, kill the thread instead of trying to 
read more from the socket

diff --git a/snap-server.cabal b/snap-server.cabal
index b9e465c..afaa34a 100644
--- a/snap-server.cabal
+++ b/snap-server.cabal
@@ -1,5 +1,5 @@
 name:           snap-server
-version:        0.2.14
+version:        0.2.13.1
 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
@@ -122,7 +122,7 @@ Library
     murmur-hash >= 0.1 && < 0.2,
     network == 2.2.1.*,
     old-locale,
-    snap-core >= 0.2.14 && <0.3,
+    snap-core == 0.2.13,
     template-haskell,
     time,
     transformers,
diff --git a/src/Snap/Internal/Http/Server.hs b/src/Snap/Internal/Http/Server.hs
index acd5022..c73d367 100644
--- a/src/Snap/Internal/Http/Server.hs
+++ b/src/Snap/Internal/Http/Server.hs
@@ -305,6 +305,7 @@ runHTTP lh lip lp rip rp alog elog
                                    handler
         let iter = iterateeDebugWrapper "httpSession iteratee" iter1
         readEnd iter >>= run
+        debug "runHTTP/go: finished"
 
 
 ------------------------------------------------------------------------------
@@ -345,8 +346,6 @@ httpSession writeEnd' ibuf onSendFile tickle handler = do
     liftIO $ debug "Server.httpSession: entered"
     mreq  <- receiveRequest
 
-    
-
     -- successfully got a request, so restart timer
     liftIO tickle
 
@@ -396,7 +395,9 @@ httpSession writeEnd' ibuf onSendFile tickle handler = do
                 (rspContentLength rsp')
 
           if cc
-             then return ()
+             then do
+                 debug $ "httpSession: Connection: Close, harikari"
+                 liftIO $ myThreadId >>= killThread
              else httpSession writeEnd' ibuf onSendFile tickle handler
 
       Nothing -> do
@@ -423,7 +424,7 @@ checkExpect100Continue req writeEnd = do
                  , bsshow major
                  , "."
                  , bsshow minor
-                 , " 100 Continue\r\n\r\n" ] 
+                 , " 100 Continue\r\n\r\n" ]
         iter <- liftIO $ enumBS (S.concat hl) writeEnd
         liftIO $ run iter
 
@@ -636,7 +637,10 @@ sendResponse req rsp' writeEnd onSendFile = do
                      else enumBS hs >. e >. enumEof
 
         let hl = fromIntegral $ S.length hs
+
+        debug $ "sendResponse: whenEnum: enumerating bytes"
         (x,bs) <- joinIM $ enum (countBytes writeEnd)
+        debug $ "sendResponse: whenEnum: " ++ Prelude.show bs ++ " bytes 
enumerated"
 
         return (x, bs-hl)
 
diff --git a/src/Snap/Internal/Http/Server/SimpleBackend.hs 
b/src/Snap/Internal/Http/Server/SimpleBackend.hs
index 96901f1..657ddc2 100644
--- a/src/Snap/Internal/Http/Server/SimpleBackend.hs
+++ b/src/Snap/Internal/Http/Server/SimpleBackend.hs
@@ -392,8 +392,11 @@ timeoutRecv conn n = do
 
 timeoutSend :: Connection -> ByteString -> IO ()
 timeoutSend conn s = do
+    let len = B.length s
+    debug $ "Backend.timeoutSend: entered w/ " ++ show len ++ " bytes"
     let sock = _socket conn
     SB.sendAll sock s
+    debug $ "Backend.timeoutSend: sent all"
     tickleTimeout conn
 
 
@@ -405,7 +408,10 @@ enumerate :: (MonadIO m) => Connection -> Enumerator m a
 enumerate = loop
   where
     loop conn f = do
+        debug $ "Backend.enumerate: reading from socket"
         s <- liftIO $ timeoutRecv conn bLOCKSIZE
+        debug $ "Backend.enumerate: got " ++ Prelude.show (B.length s)
+                ++ " bytes from read end"
         sendOne conn f s
 
     sendOne conn f s = do
diff --git a/test/common/Test/Common/TestHandler.hs 
b/test/common/Test/Common/TestHandler.hs
index 7719dde..72bfbcf 100644
--- a/test/common/Test/Common/TestHandler.hs
+++ b/test/common/Test/Common/TestHandler.hs
@@ -15,6 +15,7 @@ import           Snap.Iteratee hiding (Enumerator)
 import           Snap.Types
 import           Snap.Http.Server
 import           Snap.Util.FileServe
+import           Snap.Util.GZip
 import           Snap.Internal.Iteratee.Debug
 import           Test.Common.Rot13 (rot13)
 
@@ -61,7 +62,7 @@ responseHandler = do
 
 
 testHandler :: Snap ()
-testHandler =
+testHandler = withCompression $
     route [ ("pong"           , pongHandler                  )
           , ("echo"           , echoHandler                  )
           , ("rot13"          , rot13Handler                 )
diff --git a/test/pongserver/Main.hs b/test/pongserver/Main.hs
index 9a80608..8e11b50 100644
--- a/test/pongserver/Main.hs
+++ b/test/pongserver/Main.hs
@@ -6,10 +6,11 @@ import           Control.Concurrent
 import           Snap.Iteratee
 import           Snap.Types
 import           Snap.Http.Server
-
+import Snap.Util.GZip
 -- FIXME: need better primitives for output
 pongServer :: Snap ()
-pongServer = modifyResponse $ setResponseBody (enumBS "PONG") .
+pongServer = withCompression $
+             modifyResponse $ setResponseBody (enumBS "PONG") .
                               setContentType "text/plain" .
                               setContentLength 4
 
@@ -25,5 +26,5 @@ main = do
 
   where
     go m = do
-        httpServe "*" 8000 "localhost" Nothing Nothing pongServer 
+        httpServe "*" 3000 "localhost" Nothing Nothing pongServer 
         putMVar m ()
-----------------------------------------------------------------------


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

Reply via email to