snap-server 0.2.13 → 0.2.13.1
raw patch · 5 files changed
+22/−10 lines, 5 filesdep ~snap-core
Dependency ranges changed: snap-core
Files
- snap-server.cabal +2/−2
- src/Snap/Internal/Http/Server.hs +8/−4
- src/Snap/Internal/Http/Server/SimpleBackend.hs +6/−0
- test/common/Test/Common/TestHandler.hs +2/−1
- test/pongserver/Main.hs +4/−3
snap-server.cabal view
@@ -1,5 +1,5 @@ name: snap-server-version: 0.2.13+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 @@ murmur-hash >= 0.1 && < 0.2, network == 2.2.1.*, old-locale,- snap-core >= 0.2.13 && <0.3,+ snap-core == 0.2.13, template-haskell, time, transformers,
src/Snap/Internal/Http/Server.hs view
@@ -305,6 +305,7 @@ handler let iter = iterateeDebugWrapper "httpSession iteratee" iter1 readEnd iter >>= run+ debug "runHTTP/go: finished" ------------------------------------------------------------------------------@@ -345,8 +346,6 @@ liftIO $ debug "Server.httpSession: entered" mreq <- receiveRequest - - -- successfully got a request, so restart timer liftIO tickle @@ -396,7 +395,9 @@ (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 @@ , 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 @@ 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)
src/Snap/Internal/Http/Server/SimpleBackend.hs view
@@ -392,8 +392,11 @@ 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 = 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
test/common/Test/Common/TestHandler.hs view
@@ -15,6 +15,7 @@ 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 @@ testHandler :: Snap ()-testHandler =+testHandler = withCompression $ route [ ("pong" , pongHandler ) , ("echo" , echoHandler ) , ("rot13" , rot13Handler )
test/pongserver/Main.hs view
@@ -6,10 +6,11 @@ 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 @@ where go m = do- httpServe "*" 8000 "localhost" Nothing Nothing pongServer + httpServe "*" 3000 "localhost" Nothing Nothing pongServer putMVar m ()