mirror of
https://github.com/typeable/wai.git
synced 2025-01-01 02:38:45 +03:00
Use ByteString-based getEnvironment on *nix systems
This commit is contained in:
parent
dc69a02d70
commit
746c04c9e9
@ -13,7 +13,6 @@ module Network.Wai.Handler.CGI
|
||||
import Network.Wai
|
||||
import Network.Wai.Internal
|
||||
import Network.Socket (getAddrInfo, addrAddress)
|
||||
import System.Environment (getEnvironment)
|
||||
import Data.Maybe (fromMaybe)
|
||||
import Control.Exception (mask)
|
||||
import qualified Data.ByteString.Char8 as B
|
||||
@ -35,6 +34,15 @@ import qualified Data.CaseInsensitive as CI
|
||||
import Data.Monoid (mappend)
|
||||
import Data.Conduit
|
||||
|
||||
#if WINDOWS
|
||||
import System.Environment (getEnvironment)
|
||||
#else
|
||||
import qualified System.Posix.Env.ByteString as Env
|
||||
|
||||
getEnvironment :: IO [(String, String)]
|
||||
getEnvironment = map (B.unpack *** B.unpack) `fmap` Env.getEnvironment
|
||||
#endif
|
||||
|
||||
safeRead :: Read a => a -> String -> a
|
||||
safeRead d s =
|
||||
case reads s of
|
||||
|
@ -47,6 +47,11 @@ Library
|
||||
, word8
|
||||
, lifted-base >= 0.1.2
|
||||
|
||||
if os(windows)
|
||||
cpp-options: -DWINDOWS
|
||||
else
|
||||
build-depends: unix
|
||||
|
||||
Exposed-modules: Network.Wai.Handler.CGI
|
||||
Network.Wai.Middleware.AcceptOverride
|
||||
Network.Wai.Middleware.Autohead
|
||||
|
Loading…
Reference in New Issue
Block a user