http-client-websockets 0.1.1.1 → 0.1.1.2
raw patch · 3 files changed
+15/−11 lines, 3 filesdep +textdep −utf8-stringPVP ok
version bump matches the API change (PVP)
Dependencies added: text
Dependencies removed: utf8-string
API changes (from Hackage documentation)
Files
CHANGELOG.md view
@@ -1,8 +1,12 @@ # Revision history for http-client-websockets +## 0.1.1.2 -- 2021-05-29++* Remove dependency on utf8-string.+ ## 0.1.1.1 -- 2021-01-08 -* Documentation updates+* Documentation updates. ## 0.1.1.0 -- 2020-10-24
http-client-websockets.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: http-client-websockets-version: 0.1.1.1+version: 0.1.1.2 synopsis: Glue code for http-client and websockets description:@@ -38,8 +38,8 @@ Network.HTTP.Client.WebSockets build-depends: base >= 4.11 && < 5- , utf8-string , bytestring+ , text , network-uri >= 2.6 , http-client >= 0.6 , websockets >= 0.12
src/Network/HTTP/Client/WebSockets.hs view
@@ -40,9 +40,11 @@ ) where -import qualified Codec.Binary.UTF8.Generic as UTF8+import Control.Exception (throwIO) import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as LB+import qualified Data.Text as T+import qualified Data.Text.Encoding as T import qualified Network.HTTP.Client as HTTP import qualified Network.HTTP.Client.Internal as HTTP import Network.URI (URI (..))@@ -91,6 +93,8 @@ IO a runClientWithRequest mgr req connOpts app = do HTTP.withConnection req mgr $ \conn -> do+ host <- toStringUtf8 $ HTTP.host req+ path <- toStringUtf8 $ HTTP.path req <> HTTP.queryString req let read = do bs <- HTTP.connectionRead conn pure $ if B.null bs then Nothing else Just bs@@ -98,10 +102,6 @@ Nothing -> HTTP.connectionClose conn Just bs -> HTTP.connectionWrite conn $ LB.toStrict bs stream <- WS.makeStream read write- WS.runClientWithStream- stream- (UTF8.toString $ HTTP.host req)- (UTF8.toString $ HTTP.path req <> HTTP.queryString req)- connOpts- (HTTP.requestHeaders req)- app+ WS.runClientWithStream stream host path connOpts (HTTP.requestHeaders req) app+ where+ toStringUtf8 = fmap T.unpack . either throwIO pure . T.decodeUtf8'