hack2-handler-mongrel2-http 2011.6.25 → 2011.10.31
raw patch · 4 files changed
+35/−7 lines, 4 filesdep ~basedep ~blaze-builderdep ~enumerator
Dependency ranges changed: base, blaze-builder, enumerator
Files
- hack2-handler-mongrel2-http.cabal +5/−4
- readme.md +5/−0
- src/Hack2/Handler/Mongrel2/IO.hs +3/−3
- src/Hack2/Handler/Mongrel2/Utils.hs +22/−0
hack2-handler-mongrel2-http.cabal view
@@ -1,5 +1,5 @@ Name: hack2-handler-mongrel2-http-Version: 2011.6.25+Version: 2011.10.31 Build-type: Simple Synopsis: Hack2 Mongrel2 HTTP handler Description: Hack2 Mongrel2 HTTP handler@@ -16,14 +16,14 @@ library build-depends: - base >= 4.0 && < 5+ base >= 4.0 && < 100 , network , bytestring , data-default >= 0.2 , hack2 >= 2011.6.20 , containers , mtl- , enumerator < 5+ , enumerator , air , zeromq-haskell , directory@@ -31,7 +31,7 @@ , text , aeson , blaze-textual- , blaze-builder < 0.4+ , blaze-builder , unix , attoparsec , stm@@ -43,4 +43,5 @@ Hack2.Handler.Mongrel2.MessageParser Hack2.Handler.Mongrel2.Response Hack2.Handler.Mongrel2.Types+ Hack2.Handler.Mongrel2.Utils
readme.md view
@@ -34,6 +34,11 @@ now visit: <http://localhost:6767>, you should see a hello world page. +Monkey fix the Dependency Hell+------------------------------++* add what you need into `hack2-handler-mongrel2-http.cabal` and `cabal install`, this will make sure the correct version of your libraries are pre-linked with mongrel2-http.+ Useful getting started resource -------------------------------
src/Hack2/Handler/Mongrel2/IO.hs view
@@ -147,8 +147,8 @@ -- _send_iteratee :: Iteratee ByteString IO ()- _send_iteratee = continue loop where- loop (Chunks xs) = do+ _send_iteratee = continue consume where+ consume (Chunks xs) = do _ids <- io - atomically - readTVar disconnected @@ -164,7 +164,7 @@ _send_iteratee - loop EOF = do+ consume EOF = do yield () EOF -- let combined = B.append _responseHeader _responseBody
+ src/Hack2/Handler/Mongrel2/Utils.hs view
@@ -0,0 +1,22 @@+module Hack2.Handler.Mongrel2.Utils where++import Control.Concurrent+import System.IO.Unsafe (unsafePerformIO)+import Prelude ()+import Air.Env hiding (log)+import System.IO++sync_lock :: MVar ()+sync_lock = unsafePerformIO - newMVar ()++jailed :: IO a -> IO a+jailed io = do+ withMVar sync_lock (const io)++log :: String -> IO ()+-- log x = jailed - putStrLn x+log x = return ()+++log_error :: String -> IO ()+log_error x = jailed - hPutStr stderr x