Fixes for WAI 2.1

This commit is contained in:
Michael Snoyman 2014-06-10 13:59:35 +03:00
parent 32e729fdb3
commit 1f704e914d
4 changed files with 16 additions and 5 deletions

View File

@ -302,8 +302,9 @@ yesodRunner handler' YesodRunnerEnv {..} route req
#if MIN_VERSION_wai(2, 0, 0) #if MIN_VERSION_wai(2, 0, 0)
bracketOnError createInternalState closeInternalState $ \is -> do bracketOnError createInternalState closeInternalState $ \is -> do
yar <- runInternalState (runHandler rhe handler yreq) is yreq' <- yreq
liftIO $ yarToResponse yar saveSession yreq req is yar <- runInternalState (runHandler rhe handler yreq') is
liftIO $ yarToResponse yar saveSession yreq' req is
#else #else
yar <- runHandler rhe handler yreq yar <- runHandler rhe handler yreq
liftIO $ yarToResponse yar saveSession yreq req liftIO $ yarToResponse yar saveSession yreq req

View File

@ -1,5 +1,5 @@
name: yesod-core name: yesod-core
version: 1.2.16 version: 1.2.16.1
license: MIT license: MIT
license-file: LICENSE license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com> author: Michael Snoyman <michael@snoyman.com>

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE MultiParamTypeClasses #-}
module Yesod.WebSockets module Yesod.WebSockets
@ -46,7 +47,12 @@ webSockets :: (Y.MonadBaseControl IO m, Y.MonadHandler m) => WebSocketsT m () ->
webSockets inner = do webSockets inner = do
req <- Y.waiRequest req <- Y.waiRequest
when (WaiWS.isWebSocketsReq req) $ when (WaiWS.isWebSocketsReq req) $
Y.sendRawResponseNoConduit $ \src sink -> control $ \runInIO -> WaiWS.runWebSockets #if MIN_VERSION_wai(3, 0, 0)
Y.sendRawResponseNoConduit
#else
Y.sendRawResponse
#endif
$ \src sink -> control $ \runInIO -> WaiWS.runWebSockets
WS.defaultConnectionOptions WS.defaultConnectionOptions
(WaiWS.getRequestHead req) (WaiWS.getRequestHead req)
(\pconn -> do (\pconn -> do

View File

@ -2,7 +2,7 @@
-- documentation, see http://haskell.org/cabal/users-guide/ -- documentation, see http://haskell.org/cabal/users-guide/
name: yesod-websockets name: yesod-websockets
version: 0.1.1 version: 0.1.1.1
synopsis: WebSockets support for Yesod synopsis: WebSockets support for Yesod
description: WebSockets support for Yesod description: WebSockets support for Yesod
homepage: https://github.com/yesodweb/yesod homepage: https://github.com/yesodweb/yesod
@ -17,6 +17,10 @@ cabal-version: >=1.8
library library
exposed-modules: Yesod.WebSockets exposed-modules: Yesod.WebSockets
build-depends: base >= 4.5 && < 5 build-depends: base >= 4.5 && < 5
-- Just for CPP macro
, wai
, wai-websockets >= 2.1 , wai-websockets >= 2.1
, websockets >= 0.8 , websockets >= 0.8
, transformers >= 0.2 , transformers >= 0.2