hack-handler-kibro 2009.4.51 → 2009.5.19
raw patch · 3 files changed
+31/−18 lines, 3 filesdep ~hackPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: hack
API changes (from Hackage documentation)
Files
- changelog.md +7/−0
- hack-handler-kibro.cabal +2/−2
- src/Hack/Handler/Kibro.hs +22/−16
changelog.md view
@@ -1,3 +1,10 @@+2009.5.19+---------++### Feature++* Compatible with hack 5.19+ 2009.4.51 ---------
hack-handler-kibro.cabal view
@@ -1,5 +1,5 @@ Name: hack-handler-kibro-Version: 2009.4.51+Version: 2009.5.19 Build-type: Simple Synopsis: Hack Kibro handler Description: Hack Kibro handler@@ -15,7 +15,7 @@ library ghc-options: -Wall- build-depends: base, cgi, network, data-default >= 0.2, hack >= 2009.4.51, kibro >= 0.4.3+ build-depends: base, cgi, network, data-default >= 0.2, hack >= 2009.5.19, kibro >= 0.4.3 hs-source-dirs: src/ exposed-modules: Hack.Handler.Kibro
src/Hack/Handler/Kibro.hs view
@@ -1,6 +1,6 @@ module Hack.Handler.Kibro (run) where -import Hack+import qualified Hack as Hack import Kibro import Network.CGI hiding (Html) import Network.URI@@ -12,39 +12,45 @@ a . f = f a infixl 9 . -run :: Application -> IO ()+run :: Hack.Application -> IO () run app' = startKibro [("", handle app')] where get_env = do uri <- requestURI- request_method' <- requestMethod- let script_name' = ""- let path_info' = uri.uriPath+ request_method' <- requestMethod >>= readMethod+ let script_name' = ""+ let path_info' = uri.uriPath let query_string' = uri.uriQuery server_name' <- serverName server_port' <- serverPort- hack_input' <- getBody+ hack_input' <- getBodyFPS def - { request_method = request_method'.read- , script_name = script_name'- , path_info = path_info'- , query_string = query_string'.remove_question_mark- , server_name = server_name'- , server_port = server_port'- , hack_input = hack_input'+ { Hack.requestMethod = request_method'+ , Hack.scriptName = script_name'+ , Hack.pathInfo = path_info'+ , Hack.queryString = query_string'.remove_question_mark+ , Hack.serverName = server_name'+ , Hack.serverPort = server_port'+ , Hack.hackInput = hack_input' } .return where remove_question_mark = dropWhile (== '?')+ + readMethod :: Monad m => String -> m Hack.RequestMethod+ readMethod s =+ case reads s of+ ((x, _):_) -> return x+ [] -> fail $ "Unknown request method: " ++ s handle app = do env <- get_env response <- app env .liftIO -- set response- response.headers.mapM_ (uncurry setHeader)- response.status.show.setHeader "Status"- response.body.output+ response.Hack.headers.mapM_ (uncurry setHeader)+ response.Hack.status.show.setHeader "Status"+ response.Hack.body.outputFPS