packages feed

http2-tls 0.3.0 → 0.3.1

raw patch · 4 files changed

+44/−11 lines, 4 filesdep +case-insensitivedep +http-semanticsdep ~tlsPVP ok

version bump matches the API change (PVP)

Dependencies added: case-insensitive, http-semantics

Dependency ranges changed: tls

API changes (from Hackage documentation)

+ Network.HTTP2.TLS.Client: settingsOnServerFinished :: Settings -> Information -> IO ()
+ Network.HTTP2.TLS.Client: settingsWantSessionResumeList :: Settings -> [(SessionID, SessionData)]

Files

Network/HTTP2/TLS/Client.hs view
@@ -36,7 +36,9 @@     settingsServerNameOverride,     settingsSessionManager,     settingsWantSessionResume,+    settingsWantSessionResumeList,     settingsUseEarlyData,+    settingsOnServerFinished, ) where  import Data.ByteString (ByteString)@@ -111,9 +113,11 @@     runTCPClient serverName (show port) $ \sock -> do         mysa <- getSocketName sock         peersa <- getPeerName sock-        E.bracket (contextNew sock params) bye $ \ctx -> do-            handshake ctx-            action ctx mysa peersa+        ctx <- contextNew sock params+        handshake ctx+        r <- action ctx mysa peersa+        bye ctx+        return r   where     -- TLS client parameters     params :: ClientParams@@ -214,6 +218,7 @@     (defaultParamsClient serverName (BS.C8.pack $ show port))         { clientSupported = supported         , clientWantSessionResume = settingsWantSessionResume+        , clientWantSessionResumeList = settingsWantSessionResumeList         , clientUseServerNameIndication = True         , clientShared = shared         , clientHooks = hooks@@ -237,6 +242,7 @@         def             { onSuggestALPN = return $ Just [alpn]             , onServerCertificate = validateCert+            , onServerFinished = settingsOnServerFinished             }     validateCache         | settingsValidateCert = def
Network/HTTP2/TLS/Client/Settings.hs view
@@ -8,7 +8,13 @@     cacheLimit,     defaultClientConfig,  )-import Network.TLS (SessionData, SessionID, SessionManager, noSessionManager)+import Network.TLS (+    Information,+    SessionData,+    SessionID,+    SessionManager,+    noSessionManager,+ )  -- Client settings type. data Settings = Settings@@ -67,6 +73,12 @@     --     -- >>> settingsWantSessionResume defaultSettings     -- Nothing+    , settingsWantSessionResumeList :: [(SessionID, SessionData)]+    -- ^ Try to resume a TLS session (H2 and TLS).+    -- This takes precedence over 'settingsWantSessionResume'.+    --+    -- >>> settingsWantSessionResumeList defaultSettings+    -- []     , settingsUseEarlyData :: Bool     -- ^ Try to use 0-RTT (H2 and TLS)     --@@ -74,6 +86,7 @@     --     -- >>> settingsUseEarlyData defaultSettings     -- False+    , settingsOnServerFinished :: Information -> IO ()     }  -- | Default settings.@@ -91,5 +104,7 @@         , settingsConnectionWindowSize = defaultMaxData         , settingsSessionManager = noSessionManager         , settingsWantSessionResume = Nothing+        , settingsWantSessionResumeList = []         , settingsUseEarlyData = False+        , settingsOnServerFinished = \_ -> return ()         }
http2-tls.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name:          http2-tls-version:       0.3.0+version:       0.3.1 license:       BSD3 license-file:  LICENSE maintainer:    Kazu Yamamoto <kazu@iij.ad.jp>@@ -41,19 +41,19 @@     build-depends:         base >=4.9 && <5,         bytestring >=0.10,-        http2 >=5.1 && <5.3,         data-default-class >=0.1 && <0.2,+        http2 >=5.1 && <5.3,         network >=3.1.4,-        time-manager >=0.0.1 && <0.2,-        unliftio >=0.2 && <0.3,-        network-run >=0.3 && <0.4,         network-control >=0.1 && <0.2,+        network-run >=0.3 && <0.4,         recv >=0.1.0 && <0.2,+        time-manager >=0.0.1 && <0.2,+        unliftio >=0.2 && <0.3,         utf8-string >=1.0 && <1.1      if flag(crypton)         build-depends:-            tls >=1.7 && <2.1,+            tls >=2.1 && <2.2,             crypton-x509-store >=1.6 && <1.7,             crypton-x509-validation >=1.6 && <1.7 @@ -74,6 +74,8 @@         base >=4.9 && <5,         async,         bytestring,+        case-insensitive,+        http-semantics,         http-types,         http2,         http2-tls,
util/Client.hs view
@@ -5,7 +5,10 @@  import Control.Concurrent.Async import qualified Control.Exception as E+import Control.Monad (when) import qualified Data.ByteString.Char8 as C8+import Data.CaseInsensitive (foldedCase)+import Network.HTTP.Semantics import Network.HTTP.Types  import Network.HTTP2.Client@@ -25,5 +28,12 @@     loop n = do         sendRequest req $ \rsp -> do             print $ responseStatus rsp-            getResponseBodyChunk rsp >>= C8.putStrLn+            mapM_ (\(k, v) -> C8.putStrLn (foldedCase (tokenKey k) <> ": " <> v)) $+                fst $+                    responseHeaders+                        rsp+            consume rsp         loop (n - 1)+    consume rsp = do+        x <- getResponseBodyChunk rsp+        when (x /= "") $ consume rsp