packages feed

wai-frontend-monadcgi 0.0.2 → 1.0.0

raw patch · 2 files changed

+28/−15 lines, 2 filesdep +case-insensitivedep +conduitdep +http-typesdep ~waiPVP ok

version bump matches the API change (PVP)

Dependencies added: case-insensitive, conduit, http-types, transformers

Dependency ranges changed: wai

API changes (from Hackage documentation)

Files

Network/Wai/Frontend/MonadCGI.hs view
@@ -4,10 +4,14 @@     ) where  import Network.Wai-import Network.Wai.Source import Network.CGI.Monad import Network.CGI.Protocol+import Network.HTTP.Types (Status (..))+import Control.Monad.IO.Class (liftIO)+import Data.CaseInsensitive (original) +import Data.Conduit.Lazy (lazyConsume)+ import qualified Data.Map as Map import qualified Data.ByteString.Lazy as BS import qualified Data.ByteString.Char8 as S8@@ -29,7 +33,7 @@                 -> CGIT m CGIResult                 -> Application cgiToAppGeneric toIO cgi env = do-    input <- toLBS $ requestBody env+    input <- fmap BS.fromChunks $ lazyConsume $ requestBody env     let vars = map (first fixVarName . go) (requestHeaders env)                ++ getCgiVars env         (inputs, body') = decodeInput vars input@@ -38,7 +42,7 @@                 , cgiInputs = inputs                 , cgiRequestBody = body'                 }-    (headers'', output') <- toIO $ runCGIT cgi req+    (headers'', output') <- liftIO $ toIO $ runCGIT cgi req     let output = case output' of                     CGIOutput bs -> bs                     CGINothing -> BS.empty@@ -47,9 +51,9 @@     let status' = case lookup (fromString "Status") headers' of                     Nothing -> 200                     Just s -> safeRead 200 $ S8.unpack s-    return $ Response (Status status' S8.empty) headers' $ ResponseLBS output+    return $ responseLBS (Status status' S8.empty) headers' output   where-    go (x, y) = (S8.unpack $ ciOriginal x, S8.unpack y)+    go (x, y) = (S8.unpack $ original x, S8.unpack y)  fixVarName :: String -> String fixVarName = ((++) $ "HTTP_") . map fixVarNameChar@@ -60,9 +64,9 @@  getCgiVars :: Request -> [(String, String)] getCgiVars e =-    [ ("PATH_INFO", S8.unpack $ pathInfo e)+    [ ("PATH_INFO", S8.unpack $ rawPathInfo e)     , ("REQUEST_METHOD", show $ requestMethod e)-    , ("QUERY_STRING", S8.unpack $ queryString e)+    , ("QUERY_STRING", S8.unpack $ rawQueryString e)     , ("SERVER_NAME", S8.unpack $ serverName e)     , ("SERVER_PORT", show $ serverPort e)     ]
wai-frontend-monadcgi.cabal view
@@ -1,20 +1,29 @@ name:            wai-frontend-monadcgi-version:         0.0.2+version:         1.0.0 license:         BSD3 license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com> maintainer:      Michael Snoyman <michael@snoyman.com>-synopsis:        Allows programs written against MonadCGI to run with any WAI handler. (deprecated)+synopsis:        Run CGI apps on WAI.+description:     Allows programs written against MonadCGI to run with any WAI handler. This is most useful for running your existing CGI apps on Warp. For true "yo dawg"-ness, try running this through the WAI CGI backend. category:        Web stability:       stable-cabal-version:   >= 1.2+cabal-version:   >= 1.6 build-type:      Simple  library-    build-depends: base >= 4 && < 5,-                   bytestring,-                   containers >= 0.2,-                   cgi,-                   wai >= 0.2 && < 0.3+    build-depends: base              >= 4        && < 5+                 , bytestring+                 , containers        >= 0.2+                 , cgi+                 , conduit           >= 0.0.1+                 , http-types+                 , transformers+                 , case-insensitive+                 , wai               >= 1.0      && < 1.1     exposed-modules: Network.Wai.Frontend.MonadCGI     ghc-options:     -Wall++Source-repository head+    type:            git+    location:        git://github.com/yesodweb/wai.git