summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-05-02 22:45:58 -0400
committerJoey Hess <joeyh@joeyh.name>2017-05-02 22:45:58 -0400
commitee4f328031c8072868854ebcd5a1e5b628a226ae (patch)
treedfcd14d0433c1aba608aa8e5cacd0791965267aa
parent3b7b248eaada1bbf71f467c37a5da1196e1bba83 (diff)
downloaddebug-me-ee4f328031c8072868854ebcd5a1e5b628a226ae.tar.gz
allow building with versions in debian
When built with old websockets, compression is not supported. Client and server will negotiate that so version skew between them is not a problem.
-rw-r--r--Gpg/Wot.hs4
-rw-r--r--WebSockets.hs7
-rw-r--r--debug-me.cabal4
3 files changed, 10 insertions, 5 deletions
diff --git a/Gpg/Wot.hs b/Gpg/Wot.hs
index a5d0450..f9051e9 100644
--- a/Gpg/Wot.hs
+++ b/Gpg/Wot.hs
@@ -62,7 +62,7 @@ wotServer = "https://pgp.cs.uu.nl/"
downloadWotStats :: GpgKeyId -> IO (Maybe WotStats)
downloadWotStats (GpgKeyId k) = do
- manager <- newTlsManager
+ manager <- getGlobalManager
request <- parseRequest url
response <- httpLbs request manager
return $ decode (responseBody response)
@@ -71,7 +71,7 @@ downloadWotStats (GpgKeyId k) = do
downloadWotPath :: GpgKeyId -> GpgKeyId -> IO (Maybe WotPath)
downloadWotPath (GpgKeyId fromid) (GpgKeyId toid) = do
- manager <- newTlsManager
+ manager <- getGlobalManager
request <- parseRequest url
response <- httpLbs request manager
return $ decode (responseBody response)
diff --git a/WebSockets.hs b/WebSockets.hs
index a220c68..359fe7b 100644
--- a/WebSockets.hs
+++ b/WebSockets.hs
@@ -5,6 +5,7 @@
{-# LANGUAGE OverloadedStrings, DeriveGeneric, GeneralizedNewtypeDeriving #-}
{-# LANGUAGE FlexibleContexts, FlexibleInstances, ScopedTypeVariables #-}
+{-# LANGUAGE CPP #-}
module WebSockets (
connectionOptions,
@@ -91,7 +92,9 @@ instance WebSocketsData WireProtocol where
WireProtocolError
(Data.Aeson.decode s)
_ -> WireProtocolError "received unknown websocket message"
+#if MIN_VERSION_websockets(0,10,0)
fromDataMessage = fromLazyByteString . fromDataMessage
+#endif
-- | Modes of operation that can be requested for a websocket connection.
data Mode
@@ -113,12 +116,14 @@ instance ToJSON WireVersion
supportedWireVersions :: [WireVersion]
supportedWireVersions = [WireVersion "1"]
--- | Enable compression.
connectionOptions :: ConnectionOptions
connectionOptions = defaultConnectionOptions
+#if MIN_VERSION_websockets(0,10,0)
+ -- Enable compression.
{ connectionCompressionOptions =
PermessageDeflateCompression defaultPermessageDeflate
}
+#endif
-- For some reason, runClient throws ConnectionClosed
-- when the server hangs up cleanly. Catch this unwanted exception.
diff --git a/debug-me.cabal b/debug-me.cabal
index d3043a5..c8fbb6d 100644
--- a/debug-me.cabal
+++ b/debug-me.cabal
@@ -61,7 +61,7 @@ Executable debug-me
, graphviz (== 2999.18.*)
, time (>= 1.6)
, filepath (>= 1.4)
- , directory (>= 1.3)
+ , directory (>= 1.2)
, containers (>= 0.5)
, unordered-containers (>= 0.2)
, unbounded-delays (>= 0.1)
@@ -71,7 +71,7 @@ Executable debug-me
, http-types (>= 0.9)
, http-client (>= 0.4)
, http-client-tls (>= 0.2)
- , websockets (>= 0.11.1)
+ , websockets (>= 0.9)
, wai-websockets (>= 3.0)
, uuid (>= 1.3)
, protobuf (>= 0.2)