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)
bracketOnError createInternalState closeInternalState $ \is -> do
yar <- runInternalState (runHandler rhe handler yreq) is
liftIO $ yarToResponse yar saveSession yreq req is
yreq' <- yreq
yar <- runInternalState (runHandler rhe handler yreq') is
liftIO $ yarToResponse yar saveSession yreq' req is
#else
yar <- runHandler rhe handler yreq
liftIO $ yarToResponse yar saveSession yreq req

View File

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

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Yesod.WebSockets
@ -46,7 +47,12 @@ webSockets :: (Y.MonadBaseControl IO m, Y.MonadHandler m) => WebSocketsT m () ->
webSockets inner = do
req <- Y.waiRequest
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
(WaiWS.getRequestHead req)
(\pconn -> do

View File

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