tls-session-manager 0.1.3 → 0.1.4
raw patch · 4 files changed
+20/−2 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +5/−0
- Network/TLS/SessionTicket.hs +3/−1
- test/SessionManagerSpec.hs +11/−0
- tls-session-manager.cabal +1/−1
ChangeLog.md view
@@ -1,5 +1,10 @@ # ChangeLog for tls-session-manager +## 0.1.4++* Never wrap around the RTT of a ticket, and cap it at 10 seconds.+ [#661](https://github.com/haskell-tls/hs-tls/pull/661)+ ## 0.1.3 * Refuse a replayed 0-RTT ticket in the session ticket manager.
Network/TLS/SessionTicket.hs view
@@ -110,7 +110,9 @@ Nothing -> return Nothing Just sd -> do now <- milliseconds- let rtt = maybe 0 fromIntegral $ sessionTicketInfo sd >>= estimatedRTT+ -- Capped at 10 seconds as in the server, before it can wrap+ -- around as an Int64.+ let rtt = maybe 0 (fromIntegral . min 10000) $ sessionTicketInfo sd >>= estimatedRTT -- 'max 2000 rtt' as in the server, and a second of margin forget = now + 2 * max 2000 rtt + 1000 first <- atomicModifyIORef' used $ \q ->
test/SessionManagerSpec.hs view
@@ -65,6 +65,17 @@ threadDelay 5100000 sessionResumeOnlyOnce mgr ticket >>= (`shouldSatisfy` isJust) kill+ it "remembers a ticket with a wrapped RTT as long as with a capped one" $ do+ (mgr, kill) <- newSessionTicketManager' SessionTicket.defaultConfig+ let wrapped t = t{estimatedRTT = Just (maxBound - 4)}+ sd = sessionData (Just 3600)+ Just ticket <-+ sessionEstablish mgr "" sd{sessionTicketInfo = wrapped <$> sessionTicketInfo sd}+ sessionResumeOnlyOnce mgr ticket >>= (`shouldSatisfy` isJust)+ -- beyond the 5 seconds for an RTT within 2 seconds+ threadDelay 5100000+ sessionResumeOnlyOnce mgr ticket >>= (`shouldSatisfy` isNothing)+ kill -- While the reaper prunes, the sessions are taken away and an empty -- workload is left in their place; the pruned ones are merged back. describe "pruning" $ do
tls-session-manager.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: tls-session-manager-version: 0.1.3+version: 0.1.4 license: BSD3 license-file: LICENSE maintainer: kazu@iij.ad.jp