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  9bc3ddc7b4f827c9f924b54ff490716794587c76 (commit)
      from  7945b1412c94ca42836e8879ddf4c53c32fbc7f4 (commit)


Summary of changes:
 src/Snap/Internal/Http/Server.hs               |   47 ++++++++++++------------
 src/Snap/Internal/Http/Server/LibevBackend.hs  |    2 +-
 src/Snap/Internal/Http/Server/SimpleBackend.hs |    2 +-
 src/System/FastLogger.hs                       |    3 +-
 src/System/SendFile/Darwin.hsc                 |    5 ++-
 src/System/SendFile/FreeBSD.hsc                |    5 ++-
 src/System/SendFile/Linux.hsc                  |    7 ++--
 test/suite/Snap/Internal/Http/Server/Tests.hs  |    3 +-
 8 files changed, 40 insertions(+), 34 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 9bc3ddc7b4f827c9f924b54ff490716794587c76
Author: Shu-yu Guo <[email protected]>
Date:   Mon Jun 7 03:10:45 2010 -0700

    Change content-length, enumerator lengths, and file offsets from Int to 
Int64

diff --git a/src/Snap/Internal/Http/Server.hs b/src/Snap/Internal/Http/Server.hs
index 9a4d9ca..e32f613 100644
--- a/src/Snap/Internal/Http/Server.hs
+++ b/src/Snap/Internal/Http/Server.hs
@@ -18,6 +18,7 @@ import qualified Data.ByteString.Char8 as SC
 import qualified Data.ByteString.Lazy as L
 import           Data.ByteString.Internal (c2w, w2c)
 import qualified Data.ByteString.Nums.Careless.Int as Cvt
+import           Data.Int
 import           Data.IORef
 import           Data.List (foldl')
 import qualified Data.Map as Map
@@ -243,18 +244,18 @@ logA' logger req rsp = do
 
 
 ------------------------------------------------------------------------------
-runHTTP :: ByteString                  -- ^ local host name
-        -> ByteString                  -- ^ local ip address
-        -> Int                         -- ^ local port
-        -> ByteString                  -- ^ remote ip address
-        -> Int                         -- ^ remote port
-        -> Maybe Logger                -- ^ access logger
-        -> Maybe Logger                -- ^ error logger
-        -> Enumerator IO ()            -- ^ read end of socket
-        -> Iteratee IO ()              -- ^ write end of socket
-        -> (FilePath -> Int -> IO ())  -- ^ sendfile end
-        -> IO ()                       -- ^ timeout tickler
-        -> ServerHandler               -- ^ handler procedure
+runHTTP :: ByteString                    -- ^ local host name
+        -> ByteString                    -- ^ local ip address
+        -> Int                           -- ^ local port
+        -> ByteString                    -- ^ remote ip address
+        -> Int                           -- ^ remote port
+        -> Maybe Logger                  -- ^ access logger
+        -> Maybe Logger                  -- ^ error logger
+        -> Enumerator IO ()              -- ^ read end of socket
+        -> Iteratee IO ()                -- ^ write end of socket
+        -> (FilePath -> Int64 -> IO ())  -- ^ sendfile end
+        -> IO ()                         -- ^ timeout tickler
+        -> ServerHandler                 -- ^ handler procedure
         -> IO ()
 runHTTP lh lip lp rip rp alog elog
         readEnd writeEnd onSendFile tickle handler =
@@ -294,11 +295,11 @@ logError s = gets _logError >>= (\l -> liftIO $ l s)
 
 ------------------------------------------------------------------------------
 -- | Runs an HTTP session.
-httpSession :: Iteratee IO ()              -- ^ write end of socket
-            -> ForeignPtr CChar            -- ^ iteratee buffer
-            -> (FilePath -> Int -> IO ())  -- ^ sendfile continuation
-            -> IO ()                       -- ^ timeout tickler
-            -> ServerHandler               -- ^ handler procedure
+httpSession :: Iteratee IO ()                -- ^ write end of socket
+            -> ForeignPtr CChar              -- ^ iteratee buffer
+            -> (FilePath -> Int64 -> IO ())  -- ^ sendfile continuation
+            -> IO ()                         -- ^ timeout tickler
+            -> ServerHandler                 -- ^ handler procedure
             -> ServerMonad ()
 httpSession writeEnd' ibuf onSendFile tickle handler = do
 
@@ -418,7 +419,7 @@ receiveRequest = do
         doIt = mbCT == Just "application/x-www-form-urlencoded"
         mbCT = liftM head $ Map.lookup "content-type" (rqHeaders req)
 
-        maximumPOSTBodySize :: Int
+        maximumPOSTBodySize :: Int64
         maximumPOSTBodySize = 10*1024*1024
 
         getIt :: ServerMonad Request
@@ -510,8 +511,8 @@ sendResponse :: Response
              -> Iteratee IO a
              -> ForeignPtr CChar
              -> IO ()
-             -> (FilePath -> Int -> IO a)
-             -> ServerMonad (Int, a)
+             -> (FilePath -> Int64 -> IO a)
+             -> ServerMonad (Int64, a)
 sendResponse rsp' writeEnd ibuf killBuffering onSendFile = do
     rsp <- fixupResponse rsp'
     let !headerString = mkHeaderString rsp
@@ -525,7 +526,7 @@ sendResponse rsp' writeEnd ibuf killBuffering onSendFile = 
do
   where
     whenEnum hs e = do
         let enum = enumBS hs >. e
-        let hl = S.length hs
+        let hl = fromIntegral $ S.length hs
 
         (x,bs) <- liftIO $ enum (countBytes writeEnd) >>= run
 
@@ -574,7 +575,7 @@ sendResponse rsp' writeEnd ibuf killBuffering onSendFile = 
do
                   return $ setHeader "Connection" "close" r
 
 
-    hasCL :: Int -> Response -> ServerMonad Response
+    hasCL :: Int64 -> Response -> ServerMonad Response
     hasCL cl r =
         {-# SCC "hasCL" #-}
         do
@@ -595,7 +596,7 @@ sendResponse rsp' writeEnd ibuf killBuffering onSendFile = 
do
     setFileSize fp r =
         {-# SCC "setFileSize" #-}
         do
-            fs <- liftM fromEnum $ liftIO $ getFileSize fp
+            fs <- liftM fromIntegral $ liftIO $ getFileSize fp
             return $ r { rspContentLength = Just fs }
 
 
diff --git a/src/Snap/Internal/Http/Server/LibevBackend.hs 
b/src/Snap/Internal/Http/Server/LibevBackend.hs
index 7fdfd0e..41585f2 100644
--- a/src/Snap/Internal/Http/Server/LibevBackend.hs
+++ b/src/Snap/Internal/Http/Server/LibevBackend.hs
@@ -115,7 +115,7 @@ name :: ByteString
 name = "libev"
 
 
-sendFile :: Connection -> FilePath -> Int -> IO ()
+sendFile :: Connection -> FilePath -> Int64 -> IO ()
 #if defined(HAS_SENDFILE)
 sendFile c fp sz = do
 #else
diff --git a/src/Snap/Internal/Http/Server/SimpleBackend.hs 
b/src/Snap/Internal/Http/Server/SimpleBackend.hs
index b54d867..1846820 100644
--- a/src/Snap/Internal/Http/Server/SimpleBackend.hs
+++ b/src/Snap/Internal/Http/Server/SimpleBackend.hs
@@ -91,7 +91,7 @@ name :: ByteString
 name = "simple"
 
 
-sendFile :: Connection -> FilePath -> Int -> IO ()
+sendFile :: Connection -> FilePath -> Int64 -> IO ()
 #if defined(HAS_SENDFILE)
 sendFile c fp sz = do
     fd <- openFd fp ReadOnly Nothing defaultFileFlags
diff --git a/src/System/FastLogger.hs b/src/System/FastLogger.hs
index 4c98675..2de0c7a 100644
--- a/src/System/FastLogger.hs
+++ b/src/System/FastLogger.hs
@@ -20,6 +20,7 @@ import qualified Data.ByteString.Lazy.Char8 as L
 import           Data.ByteString.Internal (c2w)
 import           Data.DList (DList)
 import qualified Data.DList as D
+import           Data.Int
 import           Data.IORef
 import           Data.Maybe
 import           Data.Serialize.Put
@@ -74,7 +75,7 @@ combinedLogEntry :: ByteString        -- ^ remote host
                  -> ByteString        -- ^ request line (up to you to ensure
                                       --   there are no quotes in here)
                  -> Int               -- ^ status code
-                 -> Maybe Int         -- ^ num bytes sent
+                 -> Maybe Int64       -- ^ num bytes sent
                  -> Maybe ByteString  -- ^ referer (up to you to ensure
                                       --   there are no quotes in here)
                  -> ByteString        -- ^ user agent (up to you to ensure
diff --git a/src/System/SendFile/Darwin.hsc b/src/System/SendFile/Darwin.hsc
index 9a8d98a..6459962 100644
--- a/src/System/SendFile/Darwin.hsc
+++ b/src/System/SendFile/Darwin.hsc
@@ -2,6 +2,7 @@
 -- | Darwin system-dependent code for 'sendfile'.
 module System.SendFile.Darwin (sendFile) where
 
+import Data.Int
 import Foreign.C.Error (eAGAIN, eINTR, getErrno, throwErrno)
 import Foreign.C.Types (CInt)
 import Foreign.Marshal (alloca)
@@ -9,13 +10,13 @@ import Foreign.Ptr (Ptr, nullPtr)
 import Foreign.Storable (peek, poke)
 import System.Posix.Types (Fd, COff)
 
-sendFile :: Fd -> Fd -> Int -> Int -> IO Int
+sendFile :: Fd -> Fd -> Int64 -> Int64 -> IO Int64
 sendFile 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
-        return $ fromEnum sbytes
+        return $ fromIntegral sbytes
 
 sendfile :: Fd -> Fd -> COff -> Ptr COff -> IO COff
 sendfile out_fd in_fd off pbytes = do
diff --git a/src/System/SendFile/FreeBSD.hsc b/src/System/SendFile/FreeBSD.hsc
index 9be08dc..024cf25 100644
--- a/src/System/SendFile/FreeBSD.hsc
+++ b/src/System/SendFile/FreeBSD.hsc
@@ -2,6 +2,7 @@
 -- | FreeBSD system-dependent code for 'sendfile'.
 module System.SendFile.FreeBSD (sendFile) where
 
+import Data.Int
 import Foreign.C.Error (eAGAIN, eINTR, getErrno, throwErrno)
 import Foreign.C.Types (CInt, CSize)
 import Foreign.Marshal.Alloc (alloca)
@@ -9,13 +10,13 @@ import Foreign.Ptr (Ptr, nullPtr)
 import Foreign.Storable (peek)
 import System.Posix.Types (COff, Fd)
 
-sendFile :: Fd -> Fd -> Int -> Int -> IO Int
+sendFile :: Fd -> Fd -> Int64 -> Int64 -> IO Int64
 sendFile 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
-        return $ fromEnum sbytes
+        return $ fromIntegral sbytes
 
 sendfile :: Fd -> Fd -> COff -> CSize -> Ptr COff -> IO COff
 sendfile out_fd in_fd off count pbytes =
diff --git a/src/System/SendFile/Linux.hsc b/src/System/SendFile/Linux.hsc
index 97962c2..4e437ac 100644
--- a/src/System/SendFile/Linux.hsc
+++ b/src/System/SendFile/Linux.hsc
@@ -2,6 +2,7 @@
 -- | Linux system-dependent code for 'sendfile'.
 module System.SendFile.Linux (sendFile) where
 
+import Data.Int
 import Foreign.C.Error (eAGAIN, getErrno, throwErrno)
 import Foreign.C.Types (CSize)
 import Foreign.Marshal (alloca)
@@ -9,16 +10,16 @@ import Foreign.Ptr (Ptr, nullPtr)
 import Foreign.Storable (poke)
 import System.Posix.Types (Fd, COff, CSsize)
 
-sendFile :: Fd -> Fd -> Int -> Int -> IO Int
+sendFile :: Fd -> Fd -> Int64 -> Int64 -> IO Int64
 sendFile out_fd in_fd off count
   | count == 0 = return 0
   | off == 0   = do
         sbytes <- sendfile out_fd in_fd nullPtr bytes
-        return $ fromEnum sbytes
+        return $ fromIntegral sbytes
   | otherwise  = alloca $ \poff -> do
         poke poff (fromIntegral off)
         sbytes <- sendfile out_fd in_fd poff bytes
-        return $ fromEnum sbytes
+        return $ fromIntegral sbytes
     where
       bytes = min (fromIntegral count) maxBytes
 
diff --git a/test/suite/Snap/Internal/Http/Server/Tests.hs 
b/test/suite/Snap/Internal/Http/Server/Tests.hs
index bf92b41..3f7559b 100644
--- a/test/suite/Snap/Internal/Http/Server/Tests.hs
+++ b/test/suite/Snap/Internal/Http/Server/Tests.hs
@@ -15,6 +15,7 @@ import qualified Data.ByteString.Lazy.Char8 as LC
 import           Data.ByteString (ByteString)
 import           Data.ByteString.Internal (c2w, w2c)
 import           Data.Char
+import           Data.Int
 import           Data.IORef
 import           Data.Iteratee.WrappedByteString
 import qualified Data.Map as Map
@@ -437,7 +438,7 @@ testHttp1 = testCase "http session" $ do
     assertBool "pipelined responses" ok
 
 
-mkIter :: IORef L.ByteString -> (Iteratee IO (), FilePath -> Int -> IO ())
+mkIter :: IORef L.ByteString -> (Iteratee IO (), FilePath -> Int64 -> IO ())
 mkIter ref = (iter, \f _ -> onF f iter)
   where
     iter = do
-----------------------------------------------------------------------


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

Reply via email to