warp 2.0.0.1 → 2.0.1
raw patch · 3 files changed
+25/−10 lines, 3 files
Files
- Network/Wai/Handler/Warp/Recv.hs +13/−2
- test/FdCacheSpec.hs +8/−1
- warp.cabal +4/−7
Network/Wai/Handler/Warp/Recv.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE ForeignFunctionInterface #-}---- fixme: windows support+{-# LANGUAGE CPP #-} module Network.Wai.Handler.Warp.Recv ( receive@@ -20,6 +19,10 @@ import System.Posix.Types (Fd(..)) import Network.Wai.Handler.Warp.Buffer +#ifdef mingw32_HOST_OS+import GHC.IO.FD (FD(..), readRawBufferPtr)+#endif+ ---------------------------------------------------------------- receive :: Socket -> Buffer -> Int -> IO ByteString@@ -37,9 +40,17 @@ buf' = castPtr buf size' = fromIntegral size +#ifdef mingw32_HOST_OS+receiveloop :: CInt -> Ptr Word8 -> CSize -> IO CInt+#else receiveloop :: CInt -> Ptr CChar -> CSize -> IO CInt+#endif receiveloop sock buf size = do+#ifdef mingw32_HOST_OS+ bytes <- fmap fromIntegral $ readRawBufferPtr "recv" (FD sock 1) buf 0 size+#else bytes <- c_recv sock buf size 0+#endif if bytes == -1 then do errno <- getErrno if errno == eAGAIN then do
test/FdCacheSpec.hs view
@@ -1,10 +1,13 @@+{-# LANGUAGE CPP #-}+ module FdCacheSpec where +import Test.Hspec+#ifdef SENDFILEFD import Data.IORef import Network.Wai.Handler.Warp.FdCache import System.Posix.IO (fdRead) import System.Posix.Types (Fd(..))-import Test.Hspec main :: IO () main = hspec spec@@ -18,3 +21,7 @@ writeIORef ref fd nfd <- readIORef ref fdRead nfd 1 `shouldThrow` anyIOException+#else+spec :: Spec+spec = return ()+#endif
warp.cabal view
@@ -1,5 +1,5 @@ Name: warp-Version: 2.0.0.1+Version: 2.0.1 Synopsis: A fast, light-weight web server for WAI applications. License: MIT License-file: LICENSE@@ -134,16 +134,13 @@ , time , old-locale - -- Yes, this means that the test suite will no longer work on Windows.- -- Unfortunately there is a bug in older versions of cabal, and this conditional- -- will therefore break older systems.- --if (os(linux) || os(freebsd) || os(darwin)) && flag(allow-sendfilefd)+ if (os(linux) || os(freebsd) || os(darwin)) && flag(allow-sendfilefd) Cpp-Options: -DSENDFILEFD Build-Depends: unix , hashable , http-date- --if os(windows)- -- Cpp-Options: -DWINDOWS+ if os(windows)+ Cpp-Options: -DWINDOWS Benchmark parser Type: exitcode-stdio-1.0