packages feed

snap-server 0.4.2 → 0.4.3

raw patch · 8 files changed

+51/−34 lines, 8 filesdep ~snap-core

Dependency ranges changed: snap-core

Files

snap-server.cabal view
@@ -1,5 +1,5 @@ name:           snap-server-version:        0.4.2+version:        0.4.3 synopsis:       A fast, iteratee-based, epoll-enabled web server for the Snap Framework description:   Snap is a simple and fast web development framework and server written in@@ -117,7 +117,7 @@     murmur-hash >= 0.1 && < 0.2,     network >= 2.3 && <2.4,     old-locale,-    snap-core >= 0.4.2 && <0.5,+    snap-core >= 0.4.3 && <0.5,     template-haskell,     time,     transformers,
src/Snap/Http/Server/Config.hs view
@@ -31,6 +31,7 @@    , setHostname   , addListen+  , setListen   , setAccessLog   , setErrorLog   , setLocale@@ -509,6 +510,11 @@ ------------------------------------------------------------------------------ addListen :: MonadSnap m => ConfigListen -> Config m a -> Config m a addListen a m = m {listen = a : listen m}+++------------------------------------------------------------------------------+setListen :: MonadSnap m => [ConfigListen] -> Config m a -> Config m a+setListen a m = m {listen = a}   ------------------------------------------------------------------------------
src/Snap/Internal/Http/Server/LibevBackend.hs view
@@ -662,7 +662,7 @@     go off bytes fd       | bytes == 0 = return ()       | otherwise  = do-            sent <- SF.sendFile sfd fd off bytes+            sent <- SF.sendFile (waitForLock False c) sfd fd off bytes             if sent < bytes               then tickleTimeout c defaultTimeout >>                    go (off+sent) (bytes-sent) fd
src/Snap/Internal/Http/Server/SimpleBackend.hs view
@@ -220,7 +220,8 @@     go off bytes fd       | bytes == 0 = return ()       | otherwise  = do-            sent <- SF.sendFile sfd fd off bytes+            sent <- SF.sendFile (threadWaitWrite $ fromIntegral sock)+                                sfd fd off bytes             if sent < bytes               then tickle >> go (off+sent) (bytes-sent) fd               else return ()
src/System/SendFile/Darwin.hsc view
@@ -10,23 +10,26 @@ import Foreign.Storable (peek, poke) import System.Posix.Types (Fd, COff) -sendFile :: Fd -> Fd -> Int64 -> Int64 -> IO Int64-sendFile out_fd in_fd off count+sendFile :: IO () -> Fd -> Fd -> Int64 -> Int64 -> IO Int64+sendFile onBlock out_fd in_fd off count   | count == 0 = return 0   | otherwise  = alloca $ \pbytes -> do         poke pbytes $ min maxBytes (fromIntegral count)-        sbytes <- sendfile out_fd in_fd (fromIntegral off) pbytes+        sbytes <- sendfile onBlock out_fd in_fd (fromIntegral off) pbytes         return $ fromIntegral sbytes -sendfile :: Fd -> Fd -> COff -> Ptr COff -> IO COff-sendfile out_fd in_fd off pbytes = do+sendfile :: IO () -> Fd -> Fd -> COff -> Ptr COff -> IO COff+sendfile onBlock out_fd in_fd off pbytes = do     status <- c_sendfile out_fd in_fd off pbytes     nsent <- peek pbytes     if status == 0       then return nsent       else do errno <- getErrno               if (errno == eAGAIN) || (errno == eINTR)-                then return nsent+                then do+                    if nsent == 0+                      then onBlock >> sendfile onBlock out_fd in_fd off pbytes+                      else return nsent                 else throwErrno "System.SendFile.Darwin"  -- max num of bytes in one send@@ -38,4 +41,5 @@     :: Fd -> Fd -> COff -> Ptr COff -> Ptr () -> CInt -> IO CInt  c_sendfile :: Fd -> Fd -> COff -> Ptr COff -> IO CInt-c_sendfile out_fd in_fd off pbytes = c_sendfile_darwin in_fd out_fd off pbytes nullPtr 0+c_sendfile out_fd in_fd off pbytes =+    c_sendfile_darwin in_fd out_fd off pbytes nullPtr 0
src/System/SendFile/FreeBSD.hsc view
@@ -11,25 +11,31 @@ import Foreign.Storable (peek) import System.Posix.Types (COff, Fd) -sendFile :: Fd -> Fd -> Int64 -> Int64 -> IO Int64-sendFile out_fd in_fd off count+sendFile :: IO () -> Fd -> Fd -> Int64 -> Int64 -> IO Int64+sendFile onBlock out_fd in_fd off count   | count == 0 = return 0   | otherwise  = alloca $ \pbytes -> do-        sbytes <- sendfile out_fd in_fd (fromIntegral off)-                                        (fromIntegral count) pbytes+        sbytes <- sendfile onBlock out_fd in_fd+                           (fromIntegral off)+                           (fromIntegral count)+                           pbytes         return $ fromIntegral sbytes -sendfile :: Fd -> Fd -> COff -> CSize -> Ptr COff -> IO COff-sendfile out_fd in_fd off count pbytes =-    do threadWaitWrite out_fd-       res <- c_sendfile_freebsd in_fd out_fd off count nullPtr pbytes 0-       nsent <- peek pbytes-       if (res == 0)-          then return nsent-          else do errno <- getErrno-                  if (errno == eAGAIN) || (errno == eINTR)-                   then return nsent-                   else throwErrno "System.SendFile.FreeBSD.sendfile"+sendfile :: IO () -> Fd -> Fd -> COff -> CSize -> Ptr COff -> IO COff+sendfile onBlock out_fd in_fd off count pbytes = do+    res <- c_sendfile_freebsd in_fd out_fd off count nullPtr pbytes 0+    nsent <- peek pbytes+    if (res == 0)+       then return nsent+       else do+           errno <- getErrno+           if (errno == eAGAIN) || (errno == eINTR)+             then if nsent == 0+                    then do+                        onBlock+                        sendfile onBlock out_fd in_fd off count pbytes+                    else return nsent+             else throwErrno "System.SendFile.FreeBSD.sendfile"  -- max num of bytes in one send maxBytes :: CSize
src/System/SendFile/Linux.hsc view
@@ -10,26 +10,26 @@ import Foreign.Storable (poke) import System.Posix.Types (Fd, COff, CSsize) -sendFile :: Fd -> Fd -> Int64 -> Int64 -> IO Int64-sendFile out_fd in_fd off count+sendFile :: IO () -> Fd -> Fd -> Int64 -> Int64 -> IO Int64+sendFile onBlock out_fd in_fd off count   | count == 0 = return 0   | off == 0   = do-        sbytes <- sendfile out_fd in_fd nullPtr bytes+        sbytes <- sendfile onBlock out_fd in_fd nullPtr bytes         return $ fromIntegral sbytes   | otherwise  = alloca $ \poff -> do         poke poff (fromIntegral off)-        sbytes <- sendfile out_fd in_fd poff bytes+        sbytes <- sendfile onBlock out_fd in_fd poff bytes         return $ fromIntegral sbytes     where       bytes = min (fromIntegral count) maxBytes -sendfile :: Fd -> Fd -> Ptr COff -> CSize -> IO CSsize-sendfile out_fd in_fd poff bytes = do+sendfile :: IO () -> Fd -> Fd -> Ptr COff -> CSize -> IO CSsize+sendfile onBlock out_fd in_fd poff bytes = do     nsent <- c_sendfile out_fd in_fd poff bytes     if nsent <= -1       then do errno <- getErrno               if errno == eAGAIN-                then sendfile out_fd in_fd poff bytes+                then onBlock >> sendfile onBlock out_fd in_fd poff bytes                 else throwErrno "System.SendFile.Linux"       else return nsent 
test/snap-server-testsuite.cabal view
@@ -46,7 +46,7 @@      old-locale,      parallel > 2,      process,-     snap-core >= 0.4.1 && <0.5,+     snap-core >= 0.4.3 && <0.5,      template-haskell,      test-framework >= 0.3.1 && <0.4,      test-framework-hunit >= 0.2.5 && < 0.3,