happstack-fastcgi 0.1.1 → 0.1.2
raw patch · 2 files changed
+17/−13 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- happstack-fastcgi.cabal +1/−1
- src/Happstack/Server/FastCGI.hs +16/−12
happstack-fastcgi.cabal view
@@ -1,5 +1,5 @@ Name: happstack-fastcgi-Version: 0.1.1+Version: 0.1.2 Copyright: Tupil Maintainer: ce [at] tupil.com, eml [at] tupil.com License: BSD3
src/Happstack/Server/FastCGI.hs view
@@ -81,39 +81,43 @@ -- | Look up a String in the cgiVars, returning the empty string if the key is not present str k v = withDef "" (v ? k) +-- | Append if the list is not empty+x ?: [] = []+x ?: xs = x : xs+ cgiUri :: CGIRequest -> String-cgiUri = str "REQUEST_URI"+cgiUri x = str "PATH_INFO" x ++ cgiQuery x cgiMethod :: CGIRequest -> Method-cgiMethod x = withDef GET $ (x ? "HTTP_METHOD") >>= maybeRead+cgiMethod x = withDef GET $ (x ? "REQUEST_METHOD") >>= maybeRead cgiPaths :: CGIRequest -> [String] cgiPaths = split '/' . str "PATH_INFO" cgiQuery :: CGIRequest -> String-cgiQuery x = '?':(str "QUERY_STRING" x)+cgiQuery x = '?' ?: (str "QUERY_STRING" x) cgiInputs :: CGI [(String, Input)] cgiInputs = getInputNames >>= mapM toHappstackInput cgiCookies :: CGIRequest -> [(String, H.Cookie)]-cgiCookies = map cookieWithName . either (const []) id . parseCookies . str "HTTP_COOKIE"+cgiCookies = map cookieWithName . either (const []) id . parseCookies . str "HTTP_COOKIE" cgiVersion :: CGIRequest -> Version-cgiVersion = parseProtocol . str "SERVER_PROTOCOL"+cgiVersion = parseProtocol . str "SERVER_PROTOCOL" cgiHeaders :: CGIRequest -> Headers-cgiHeaders = mkHeaders - . mapKeys (replace '_' '-' . drop (length httpPrefix))- . filterKey (isPrefixOf httpPrefix) - . M.toList- . cgiVars+cgiHeaders = mkHeaders + . mapKeys (replace '_' '-' . drop (length httpPrefix))+ . filterKey (isPrefixOf httpPrefix) + . M.toList+ . cgiVars cgiBody :: CGIRequest -> RqBody-cgiBody = Body . cgiRequestBody+cgiBody = Body . cgiRequestBody cgiPeer :: CGIRequest -> (String, Int)-cgiPeer r = (str "REMOTE_ADDR" r, withDef 0 (r ? "REMOTE_PORT" >>= maybeRead)) -- TODO+cgiPeer r = (str "REMOTE_ADDR" r, withDef 0 (r ? "REMOTE_PORT" >>= maybeRead)) -- TODO -- | Replace x by y in a map