Fix some CPP
This commit is contained in:
parent
2d0f560bea
commit
366127527a
@ -230,7 +230,7 @@ runRequestBody = do
|
|||||||
Just rbc -> return rbc
|
Just rbc -> return rbc
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
rr <- waiRequest
|
rr <- waiRequest
|
||||||
#if MIN_VERSION_wai(0, 2, 0)
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
rbc <- liftIO $ rbHelper upload rr
|
rbc <- liftIO $ rbHelper upload rr
|
||||||
#else
|
#else
|
||||||
rbc <- liftResourceT $ rbHelper upload rr
|
rbc <- liftResourceT $ rbHelper upload rr
|
||||||
@ -986,7 +986,7 @@ rawRequestBody :: MonadHandler m => Source m S.ByteString
|
|||||||
rawRequestBody = do
|
rawRequestBody = do
|
||||||
req <- lift waiRequest
|
req <- lift waiRequest
|
||||||
transPipe
|
transPipe
|
||||||
#if MIN_VERSION_wai(0, 2, 0)
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
liftIO
|
liftIO
|
||||||
#else
|
#else
|
||||||
liftResourceT
|
liftResourceT
|
||||||
|
|||||||
@ -54,7 +54,7 @@ yarToResponse (YRPlain s' hs ct c newSess) saveSession yreq req = do
|
|||||||
let hs' = maybe finalHeaders finalHeaders' mlen
|
let hs' = maybe finalHeaders finalHeaders' mlen
|
||||||
in ResponseBuilder s hs' b
|
in ResponseBuilder s hs' b
|
||||||
go (ContentFile fp p) = ResponseFile s finalHeaders fp p
|
go (ContentFile fp p) = ResponseFile s finalHeaders fp p
|
||||||
#if MIN_VERSION_wai(0, 2, 0)
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
go (ContentSource body) = ResponseSource s finalHeaders $ transPipe (flip runInternalState $ resourceInternalState req) body
|
go (ContentSource body) = ResponseSource s finalHeaders $ transPipe (flip runInternalState $ resourceInternalState req) body
|
||||||
#else
|
#else
|
||||||
go (ContentSource body) = ResponseSource s finalHeaders body
|
go (ContentSource body) = ResponseSource s finalHeaders body
|
||||||
|
|||||||
@ -32,7 +32,7 @@ import Data.Text.Encoding.Error (lenientDecode)
|
|||||||
import Language.Haskell.TH.Syntax (Loc, qLocation)
|
import Language.Haskell.TH.Syntax (Loc, qLocation)
|
||||||
import qualified Network.HTTP.Types as H
|
import qualified Network.HTTP.Types as H
|
||||||
import Network.Wai
|
import Network.Wai
|
||||||
#if MIN_VERSION_wai(0, 2, 0)
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
import Network.Wai.Internal
|
import Network.Wai.Internal
|
||||||
#endif
|
#endif
|
||||||
import Prelude hiding (catch)
|
import Prelude hiding (catch)
|
||||||
@ -165,14 +165,14 @@ runFakeHandler fakeSessionMap logger site handler = liftIO $ do
|
|||||||
ret <- I.newIORef (Left $ InternalError "runFakeHandler: no result")
|
ret <- I.newIORef (Left $ InternalError "runFakeHandler: no result")
|
||||||
let handler' = do liftIO . I.writeIORef ret . Right =<< handler
|
let handler' = do liftIO . I.writeIORef ret . Right =<< handler
|
||||||
return ()
|
return ()
|
||||||
#if MIN_VERSION_wai(0, 2, 0)
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
let yapp internalState = runHandler
|
let yapp internalState = runHandler
|
||||||
#else
|
#else
|
||||||
let yapp = runHandler
|
let yapp = runHandler
|
||||||
#endif
|
#endif
|
||||||
RunHandlerEnv
|
RunHandlerEnv
|
||||||
{ rheRender = yesodRender site $ resolveApproot site $ fakeWaiRequest
|
{ rheRender = yesodRender site $ resolveApproot site $ fakeWaiRequest
|
||||||
#if MIN_VERSION_wai(0, 2, 0)
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
internalState
|
internalState
|
||||||
#endif
|
#endif
|
||||||
, rheRoute = Nothing
|
, rheRoute = Nothing
|
||||||
@ -191,7 +191,7 @@ runFakeHandler fakeSessionMap logger site handler = liftIO $ do
|
|||||||
(toContent ("runFakeHandler: errHandler" :: S8.ByteString))
|
(toContent ("runFakeHandler: errHandler" :: S8.ByteString))
|
||||||
(reqSession req)
|
(reqSession req)
|
||||||
fakeWaiRequest
|
fakeWaiRequest
|
||||||
#if MIN_VERSION_wai(0, 2, 0)
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
internalState
|
internalState
|
||||||
#endif
|
#endif
|
||||||
=
|
=
|
||||||
@ -200,7 +200,7 @@ runFakeHandler fakeSessionMap logger site handler = liftIO $ do
|
|||||||
, httpVersion = H.http11
|
, httpVersion = H.http11
|
||||||
, rawPathInfo = "/runFakeHandler/pathInfo"
|
, rawPathInfo = "/runFakeHandler/pathInfo"
|
||||||
, rawQueryString = ""
|
, rawQueryString = ""
|
||||||
#if MIN_VERSION_wai(0, 2, 0)
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
, resourceInternalState = internalState
|
, resourceInternalState = internalState
|
||||||
#else
|
#else
|
||||||
, serverName = "runFakeHandler-serverName"
|
, serverName = "runFakeHandler-serverName"
|
||||||
@ -215,7 +215,7 @@ runFakeHandler fakeSessionMap logger site handler = liftIO $ do
|
|||||||
, vault = mempty
|
, vault = mempty
|
||||||
, requestBodyLength = KnownLength 0
|
, requestBodyLength = KnownLength 0
|
||||||
}
|
}
|
||||||
#if MIN_VERSION_wai(0, 2, 0)
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
fakeRequest internalState =
|
fakeRequest internalState =
|
||||||
#else
|
#else
|
||||||
fakeRequest =
|
fakeRequest =
|
||||||
@ -224,7 +224,7 @@ runFakeHandler fakeSessionMap logger site handler = liftIO $ do
|
|||||||
{ reqGetParams = []
|
{ reqGetParams = []
|
||||||
, reqCookies = []
|
, reqCookies = []
|
||||||
, reqWaiRequest = fakeWaiRequest
|
, reqWaiRequest = fakeWaiRequest
|
||||||
#if MIN_VERSION_wai(0, 2, 0)
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
internalState
|
internalState
|
||||||
#endif
|
#endif
|
||||||
, reqLangs = []
|
, reqLangs = []
|
||||||
@ -232,7 +232,7 @@ runFakeHandler fakeSessionMap logger site handler = liftIO $ do
|
|||||||
, reqAccept = []
|
, reqAccept = []
|
||||||
, reqSession = fakeSessionMap
|
, reqSession = fakeSessionMap
|
||||||
}
|
}
|
||||||
#if MIN_VERSION_wai(0, 2, 0)
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
_ <- runResourceT $ do
|
_ <- runResourceT $ do
|
||||||
is <- getInternalState
|
is <- getInternalState
|
||||||
yapp is $ fakeRequest is
|
yapp is $ fakeRequest is
|
||||||
@ -276,7 +276,7 @@ yesodRunner handler' YesodRunnerEnv {..} route req
|
|||||||
{ rheOnError = runHandler rheSafe . errorHandler
|
{ rheOnError = runHandler rheSafe . errorHandler
|
||||||
}
|
}
|
||||||
yar <-
|
yar <-
|
||||||
#if MIN_VERSION_wai(0, 2, 0)
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
flip runInternalState (resourceInternalState req) $
|
flip runInternalState (resourceInternalState req) $
|
||||||
#endif
|
#endif
|
||||||
runHandler rhe handler yreq
|
runHandler rhe handler yreq
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user