From 371780532f9f51992142425c342abba9f19f7b94 Mon Sep 17 00:00:00 2001 From: Felix Paulusma Date: Sun, 3 Nov 2024 13:28:30 +0100 Subject: [PATCH 1/5] removed as much 'Data.Default' usage and added extra documentation where it was useful. --- wai-app-static/WaiAppStatic/CmdLine.hs | 2 +- wai-extra/Network/Wai/Middleware/Gzip.hs | 26 +++--- .../Network/Wai/Middleware/RequestLogger.hs | 79 +++++++++++++++---- wai-extra/example/Main.hs | 4 +- wai-extra/test/Network/Wai/ParseSpec.hs | 18 ++--- wai-extra/test/Network/Wai/TestSpec.hs | 12 +-- wai-extra/test/WaiExtraSpec.hs | 25 +++--- wai-extra/test/sample.hs | 2 +- warp-tls/Network/Wai/Handler/WarpTLS.hs | 7 +- .../Network/Wai/Handler/WarpTLS/Internal.hs | 13 ++- 10 files changed, 123 insertions(+), 65 deletions(-) diff --git a/wai-app-static/WaiAppStatic/CmdLine.hs b/wai-app-static/WaiAppStatic/CmdLine.hs index 540450285..14ef24f93 100644 --- a/wai-app-static/WaiAppStatic/CmdLine.hs +++ b/wai-app-static/WaiAppStatic/CmdLine.hs @@ -132,7 +132,7 @@ runCommandLine middleware = do port (if noindex then "no" else show index) let middle = - gzip def{gzipFiles = GzipCompress} + gzip defaultGzipSettings{gzipFiles = GzipCompress} . (if verbose then logStdout else id) . middleware clArgs runSettings diff --git a/wai-extra/Network/Wai/Middleware/Gzip.hs b/wai-extra/Network/Wai/Middleware/Gzip.hs index e0767c2f8..a0f5a85bd 100644 --- a/wai-extra/Network/Wai/Middleware/Gzip.hs +++ b/wai-extra/Network/Wai/Middleware/Gzip.hs @@ -51,7 +51,7 @@ import qualified Data.ByteString.Builder.Extra as Blaze (flush) import qualified Data.ByteString.Char8 as S8 import Data.ByteString.Lazy.Internal (defaultChunkSize) import Data.Char (isAsciiLower, isAsciiUpper, isDigit) -import Data.Default (Default (..)) +import qualified Data.Default as Default (Default (..)) import Data.Function (fix) import Data.Maybe (isJust) import qualified Data.Set as Set @@ -119,12 +119,12 @@ import Network.Wai.Util (splitCommas, trimWS) -- $settings -- --- If you would like to use the default settings, using just 'def' is enough. +-- If you would like to use the default settings, use 'defaultGzipSettings'. -- The default settings don't compress file responses, only builder and stream -- responses, and only if the response passes the MIME and length checks. (cf. -- 'defaultCheckMime' and 'gzipSizeThreshold') -- --- To customize your own settings, use the 'def' method and set the +-- To customize your own settings, use 'defaultGzipSettings' and set the -- fields you would like to change as follows: -- -- @ @@ -196,15 +196,23 @@ data GzipFiles -- $miscellaneous -- --- 'def' is re-exported for convenience sake, and 'defaultCheckMime' --- is exported in case anyone wants to use it in defining their own --- 'gzipCheckMime' function. +-- 'defaultCheckMime' is exported in case anyone wants to use it in +-- defining their own 'gzipCheckMime' function. +-- 'def' has been re-exported for convenience sake, but its use is now +-- heavily discouraged. Please use the explicit 'defaultGzipSettings'. --- | Use default MIME settings; /do not/ compress files; skip --- compression on data smaller than 860 bytes. -instance Default GzipSettings where +-- | DO NOT USE THIS INSTANCE! +-- Please use 'defaultGzipSettings'. +-- +-- This instance will be removed in a future major version. +instance Default.Default GzipSettings where def = defaultGzipSettings +-- | Deprecated synonym for the 'defaultGzipSettings'. +def :: GzipSettings +def = defaultGzipSettings +{-# Deprecated def "Please use 'defaultGzipSettings'. 'def' and the Default instance will be removed in a future major update." #-} + -- | Default settings for the 'gzip' middleware. -- -- * Does not compress files. diff --git a/wai-extra/Network/Wai/Middleware/RequestLogger.hs b/wai-extra/Network/Wai/Middleware/RequestLogger.hs index e46a04a6f..c55215468 100644 --- a/wai-extra/Network/Wai/Middleware/RequestLogger.hs +++ b/wai-extra/Network/Wai/Middleware/RequestLogger.hs @@ -11,11 +11,14 @@ module Network.Wai.Middleware.RequestLogger ( -- * Create more versions mkRequestLogger, + -- ** Settings type RequestLoggerSettings, defaultRequestLoggerSettings, + -- *** Settings fields outputFormat, autoFlush, destination, + -- ** More settings OutputFormat (..), ApacheSettings, defaultApacheSettings, @@ -23,6 +26,7 @@ module Network.Wai.Middleware.RequestLogger ( setApacheRequestFilter, setApacheUserGetter, DetailedSettings (..), + defaultDetailedSettings, OutputFormatter, OutputFormatterWithDetails, OutputFormatterWithDetailsAndHeaders, @@ -77,6 +81,8 @@ import Network.Wai.Parse ( ) -- | The logging format. +-- +-- @since 1.3.0 data OutputFormat = Apache IPAddrSource | -- | @since 3.1.8 @@ -159,14 +165,27 @@ data DetailedSettings = DetailedSettings -- ^ @since 3.1.7 } +-- | DO NOT USE THIS INSTANCE! +-- Please use 'defaultDetailedSettings' +-- +-- This instance will be removed in a future major version. instance Default DetailedSettings where - def = - DetailedSettings - { useColors = True - , mModifyParams = Nothing - , mFilterRequests = Nothing - , mPrelogRequests = False - } + def = defaultDetailedSettings + +-- | Default 'DetailedSettings' +-- +-- Uses colors, but doesn't modify nor filter anything. +-- Also doesn't prelog requests. +-- +-- @since 3.1.16 +defaultDetailedSettings :: DetailedSettings +defaultDetailedSettings = + DetailedSettings + { useColors = True + , mModifyParams = Nothing + , mFilterRequests = Nothing + , mPrelogRequests = False + } type OutputFormatter = ZonedDate -> Request -> Status -> Maybe Integer -> LogStr @@ -206,29 +225,52 @@ type OutputFormatterWithDetailsAndHeaders = -- ^ The response headers -> LogStr +-- | Where to send the logs to. +-- +-- @since 1.3.0 data Destination = Handle Handle | Logger LoggerSet | Callback Callback + +-- | When using a callback as a destination. +-- +-- @since 1.3.0 type Callback = LogStr -> IO () --- | @RequestLoggerSettings@ is an instance of Default. See for more information. +-- | Settings for the request logger. +-- +-- Sets what which format, -- -- @outputFormat@, @autoFlush@, and @destination@ are record fields -- for the record type @RequestLoggerSettings@, so they can be used to -- modify settings values using record syntax. +-- +-- @since 1.3.0 data RequestLoggerSettings = RequestLoggerSettings { outputFormat :: OutputFormat - -- ^ Default value: @Detailed@ @True@. + -- ^ Default value: @Detailed True@. + -- + -- @since 1.3.0 , autoFlush :: Bool - -- ^ Only applies when using the @Handle@ constructor for @destination@. + -- ^ Only applies when using the 'Handle' constructor for 'destination'. -- -- Default value: @True@. + -- + -- @since 1.3.0 , destination :: Destination - -- ^ Default: @Handle@ @stdout@. + -- ^ Default: @Handle stdout@. + -- + -- @since 1.3.0 } +-- | Default 'RequestLoggerSettings'. +-- +-- Use this to create 'RequestLoggerSettings', and use the +-- accompanying fields to edit these settings. +-- +-- @since 3.1.8 defaultRequestLoggerSettings :: RequestLoggerSettings defaultRequestLoggerSettings = RequestLoggerSettings @@ -237,9 +279,16 @@ defaultRequestLoggerSettings = , destination = Handle stdout } +-- | DO NOT USE THIS INSTANCE! +-- Please use 'defaultRequestLoggerSettings' instead. +-- +-- This instance will be removed in a future major release. instance Default RequestLoggerSettings where def = defaultRequestLoggerSettings +-- | Create the 'Middleware' using the given 'RequestLoggerSettings' +-- +-- @since 1.3.0 mkRequestLogger :: RequestLoggerSettings -> IO Middleware mkRequestLogger RequestLoggerSettings{..} = do let (callback, flusher) = @@ -263,7 +312,7 @@ mkRequestLogger RequestLoggerSettings{..} = do getdate return $ apacheMiddleware apacheRequestFilter apache Detailed useColors -> - let settings = def{useColors = useColors} + let settings = defaultDetailedSettings{useColors = useColors} in detailedMiddleware callbackAndFlush settings DetailedWithSettings settings -> detailedMiddleware callbackAndFlush settings @@ -339,14 +388,16 @@ customMiddlewareWithDetailsAndHeaders cb getdate formatter app req sendResponse -- the socket (see 'IPAddrSource' for more information). It logs to 'stdout'. {-# NOINLINE logStdout #-} logStdout :: Middleware -logStdout = unsafePerformIO $ mkRequestLogger def{outputFormat = Apache FromSocket} +logStdout = + unsafePerformIO $ + mkRequestLogger defaultRequestLoggerSettings{outputFormat = Apache FromSocket} -- | Development request logger middleware. -- -- This uses the 'Detailed' 'True' logging format and logs to 'stdout'. {-# NOINLINE logStdoutDev #-} logStdoutDev :: Middleware -logStdoutDev = unsafePerformIO $ mkRequestLogger def +logStdoutDev = unsafePerformIO $ mkRequestLogger defaultRequestLoggerSettings -- | Prints a message using the given callback function for each request. -- This is not for serious production use- it is inefficient. diff --git a/wai-extra/example/Main.hs b/wai-extra/example/Main.hs index 4cd558f73..3bd1497e7 100644 --- a/wai-extra/example/Main.hs +++ b/wai-extra/example/Main.hs @@ -16,7 +16,7 @@ import Network.Wai.EventSource ( ) import Network.Wai.Handler.Warp (run) import Network.Wai.Middleware.AddHeaders (addHeaders) -import Network.Wai.Middleware.Gzip (def, gzip) +import Network.Wai.Middleware.Gzip (defaultGzipSettings, gzip) app :: Chan ServerEvent -> Application app chan req respond = @@ -67,7 +67,7 @@ main :: IO () main = do chan <- newChan _ <- forkIO . eventChan $ chan - run 8080 (gzip def $ headers $ app chan) + run 8080 (gzip defaultGzipSettings $ headers $ app chan) where -- headers required for SSE to work through nginx -- not required if using warp directly diff --git a/wai-extra/test/Network/Wai/ParseSpec.hs b/wai-extra/test/Network/Wai/ParseSpec.hs index 295843474..af716e94a 100644 --- a/wai-extra/test/Network/Wai/ParseSpec.hs +++ b/wai-extra/test/Network/Wai/ParseSpec.hs @@ -138,40 +138,40 @@ caseParseRequestBody = do it "exceeding number of files" $ do SRequest req4 _bod4 <- toRequest'' ctype3 content3 - (parseRequestBodyEx (setMaxRequestNumFiles 0 def) lbsBackEnd req4) + parseRequestBodyEx (setMaxRequestNumFiles 0 def) lbsBackEnd req4 `shouldThrow` anyException it "exceeding parameter length" $ do SRequest req4 _bod4 <- toRequest'' ctype3 content3 - (parseRequestBodyEx (setMaxRequestKeyLength 2 def) lbsBackEnd req4) + parseRequestBodyEx (setMaxRequestKeyLength 2 def) lbsBackEnd req4 `shouldThrow` anyException it "exceeding file size" $ do SRequest req4 _bod4 <- toRequest'' ctype3 content3 - (parseRequestBodyEx (setMaxRequestFileSize 2 def) lbsBackEnd req4) + parseRequestBodyEx (setMaxRequestFileSize 2 def) lbsBackEnd req4 `shouldThrow` (== PayloadTooLarge) it "exceeding total file size" $ do SRequest req4 _bod4 <- toRequest'' ctype3 content3 - (parseRequestBodyEx (setMaxRequestFilesSize 20 def) lbsBackEnd req4) + parseRequestBodyEx (setMaxRequestFilesSize 20 def) lbsBackEnd req4 `shouldThrow` (== PayloadTooLarge) SRequest req5 _bod5 <- toRequest'' ctype3 content5 - (parseRequestBodyEx (setMaxRequestFilesSize 20 def) lbsBackEnd req5) + parseRequestBodyEx (setMaxRequestFilesSize 20 def) lbsBackEnd req5 `shouldThrow` (== PayloadTooLarge) it "exceeding max parm value size" $ do SRequest req4 _bod4 <- toRequest'' ctype2 content2 - (parseRequestBodyEx (setMaxRequestParmsSize 10 def) lbsBackEnd req4) + parseRequestBodyEx (setMaxRequestParmsSize 10 def) lbsBackEnd req4 `shouldThrow` (== PayloadTooLarge) it "exceeding max header lines" $ do SRequest req4 _bod4 <- toRequest'' ctype2 content2 - (parseRequestBodyEx (setMaxHeaderLines 1 def) lbsBackEnd req4) + parseRequestBodyEx (setMaxHeaderLines 1 def) lbsBackEnd req4 `shouldThrow` anyException it "exceeding header line size" $ do SRequest req4 _bod4 <- toRequest'' ctype3 content4 - (parseRequestBodyEx (setMaxHeaderLineLength 8190 def) lbsBackEnd req4) + parseRequestBodyEx (setMaxHeaderLineLength 8190 def) lbsBackEnd req4 `shouldThrow` (== RequestHeaderFieldsTooLarge) it "Testing parseRequestBodyEx with application/x-www-form-urlencoded" $ do @@ -195,7 +195,7 @@ caseParseRequestBody = do "thisisalongparameterkey=andthisbeanevenlongerparametervaluehelloworldhowareyou" let ctype = "application/x-www-form-urlencoded" SRequest req _bod <- toRequest'' ctype content - (parseRequestBodyEx (setMaxRequestParmsSize 10 def) lbsBackEnd req) + parseRequestBodyEx (setMaxRequestParmsSize 10 def) lbsBackEnd req `shouldThrow` anyException where content2 = diff --git a/wai-extra/test/Network/Wai/TestSpec.hs b/wai-extra/test/Network/Wai/TestSpec.hs index bbc57c691..672c243f2 100644 --- a/wai-extra/test/Network/Wai/TestSpec.hs +++ b/wai-extra/test/Network/Wai/TestSpec.hs @@ -108,7 +108,7 @@ spec = do ( "Set-Cookie" , toByteString $ Cookie.renderSetCookie $ - Cookie.def + Cookie.defaultSetCookie { Cookie.setCookieName = TE.encodeUtf8 name , Cookie.setCookieValue = TE.encodeUtf8 val } @@ -123,7 +123,7 @@ spec = do ( "Set-Cookie" , toByteString $ Cookie.renderSetCookie $ - Cookie.def + Cookie.defaultSetCookie { Cookie.setCookieName = TE.encodeUtf8 name , Cookie.setCookieExpires = @@ -200,7 +200,7 @@ spec = do it "sends a cookie set with setClientCookie to server" $ do sresp <- flip runSession cookieApp $ do setClientCookie - ( Cookie.def + ( Cookie.defaultSetCookie { Cookie.setCookieName = "cookie_name" , Cookie.setCookieValue = "cookie_value" } @@ -212,13 +212,13 @@ spec = do it "sends a cookie updated with setClientCookie to server" $ do sresp <- flip runSession cookieApp $ do setClientCookie - ( Cookie.def + ( Cookie.defaultSetCookie { Cookie.setCookieName = "cookie_name" , Cookie.setCookieValue = "cookie_value" } ) setClientCookie - ( Cookie.def + ( Cookie.defaultSetCookie { Cookie.setCookieName = "cookie_name" , Cookie.setCookieValue = "cookie_value2" } @@ -230,7 +230,7 @@ spec = do it "does not send a cookie deleted with deleteClientCookie to server" $ do sresp <- flip runSession cookieApp $ do setClientCookie - ( Cookie.def + ( Cookie.defaultSetCookie { Cookie.setCookieName = "cookie_name" , Cookie.setCookieValue = "cookie_value" } diff --git a/wai-extra/test/WaiExtraSpec.hs b/wai-extra/test/WaiExtraSpec.hs index bacd1beb0..78c1b9790 100644 --- a/wai-extra/test/WaiExtraSpec.hs +++ b/wai-extra/test/WaiExtraSpec.hs @@ -44,7 +44,7 @@ import Network.Wai.Middleware.Autohead (autohead) import Network.Wai.Middleware.Gzip ( GzipFiles (..), GzipSettings (..), - def, + defaultGzipSettings, defaultCheckMime, gzip, ) @@ -197,7 +197,7 @@ gzipApp = gzipApp' id gzipApp' :: (Response -> Response) -> Application gzipApp' changeRes = - gzip def $ \_ f -> + gzip defaultGzipSettings $ \_ f -> f . changeRes $ responseLBS status200 @@ -325,19 +325,19 @@ caseGzip2 = caseGzipFiles :: Assertion caseGzipFiles = do -- Default GzipSettings ignore compressing files - withSession (gzipFileApp def) $ do + withSession (gzipFileApp defaultGzipSettings) $ do _ <- doesNotEncodeGzipJSON [acceptGzip] _ <- doesNotEncodeGzipJSON [] pure () -- Just compresses the file - withSession (gzipFileApp def{gzipFiles = GzipCompress}) $ do + withSession (gzipFileApp defaultGzipSettings{gzipFiles = GzipCompress}) $ do _ <- doesEncodeGzipJSON [acceptGzip] _ <- doesNotEncodeGzipJSON [] pure () -- Checks for a "filename.gz" file in the same folder - withSession (gzipFileApp def{gzipFiles = GzipPreCompressed GzipIgnore}) $ do + withSession (gzipFileApp defaultGzipSettings{gzipFiles = GzipPreCompressed GzipIgnore}) $ do sres <- request defaultRequest @@ -354,7 +354,8 @@ caseGzipFiles = do #endif sres - doesNotEncodeGzipJSON [] >> pure () + _ <- doesNotEncodeGzipJSON [] + pure () -- If no "filename.gz" file is in the same folder, just ignore withSession (noPreCompressApp $ GzipPreCompressed GzipIgnore) $ do @@ -375,7 +376,7 @@ caseGzipFiles = do assertBool s $ length fs == n checkTempDir 0 "temp directory should be empty" -- Respond with "test/json" file - withSession (gzipFileApp def{gzipFiles = GzipCacheFolder path}) $ do + withSession (gzipFileApp defaultGzipSettings{gzipFiles = GzipCacheFolder path}) $ do _ <- doesEncodeGzipJSON [acceptGzip] liftIO $ checkTempDir 1 "should have one file" _ <- doesEncodeGzipJSON [acceptGzip] @@ -393,13 +394,13 @@ caseGzipFiles = do liftIO $ checkTempDir 2 "again should not have done anything" -- try "test/json" again, just to make sure it isn't a weird Session bug - withSession (gzipFileApp def{gzipFiles = GzipCacheFolder path}) $ do + withSession (gzipFileApp defaultGzipSettings{gzipFiles = GzipCacheFolder path}) $ do _ <- doesEncodeGzipJSON [acceptGzip] liftIO $ checkTempDir 2 "just to make sure it isn't a fluke" where noPreCompressApp set = gzipFileApp' - def{gzipFiles = set} + defaultGzipSettings{gzipFiles = set} $ const $ responseFile status200 @@ -620,7 +621,7 @@ caseDebugRequestBody = do iactual <- I.newIORef mempty middleware <- mkRequestLogger - def + defaultRequestLoggerSettings { destination = Callback $ \strs -> I.modifyIORef iactual (`mappend` strs) , outputFormat = Detailed False } @@ -755,7 +756,7 @@ caseModifyPostParamsInLogs = do iactual <- I.newIORef mempty middleware <- mkRequestLogger - def + defaultRequestLoggerSettings { destination = Callback $ \strs -> I.modifyIORef iactual (`mappend` strs) , outputFormat = format } @@ -795,7 +796,7 @@ caseFilterRequestsInLogs = do iactual <- I.newIORef mempty middleware <- mkRequestLogger - def + defaultRequestLoggerSettings { destination = Callback $ \strs -> I.modifyIORef iactual (`mappend` strs) , outputFormat = format } diff --git a/wai-extra/test/sample.hs b/wai-extra/test/sample.hs index a21fffb91..93d49c819 100644 --- a/wai-extra/test/sample.hs +++ b/wai-extra/test/sample.hs @@ -30,4 +30,4 @@ app request = return $ case pathInfo request of _ -> ResponseFile status404 [] "../LICENSE" Nothing main :: IO () -main = run 3000 $ gzip def $ jsonp app +main = run 3000 $ gzip defaultGzipSettings $ jsonp app diff --git a/warp-tls/Network/Wai/Handler/WarpTLS.hs b/warp-tls/Network/Wai/Handler/WarpTLS.hs index e2605f6d5..3961022dc 100644 --- a/warp-tls/Network/Wai/Handler/WarpTLS.hs +++ b/warp-tls/Network/Wai/Handler/WarpTLS.hs @@ -59,7 +59,6 @@ import Control.Applicative ((<|>)) import Control.Monad (guard, void) import qualified Data.ByteString as S import qualified Data.ByteString.Lazy as L -import Data.Default (def) import qualified Data.IORef as I import Data.Streaming.Network (bindPortTCP, safeRecv) import Data.Typeable (Typeable) @@ -259,7 +258,7 @@ runTLSSocket' tlsset@TLSSettings{..} set credentials mgr sock = where get = getter tlsset set sock params params = - def -- TLS.ServerParams + TLS.defaultParamsServer { TLS.serverWantClientCert = tlsWantClientCert , TLS.serverCACertificates = [] , TLS.serverDHEParams = tlsServerDHEParams @@ -278,12 +277,12 @@ runTLSSocket' tlsset@TLSSettings{..} set credentials mgr sock = <|> (if settingsHTTP2Enabled set then Just alpn else Nothing) } shared = - def + TLS.defaultShared { TLS.sharedCredentials = credentials , TLS.sharedSessionManager = mgr } supported = - def -- TLS.Supported + TLS.defaultSupported { TLS.supportedVersions = tlsAllowedVersions , TLS.supportedCiphers = tlsCiphers , TLS.supportedCompressions = [TLS.nullCompression] diff --git a/warp-tls/Network/Wai/Handler/WarpTLS/Internal.hs b/warp-tls/Network/Wai/Handler/WarpTLS/Internal.hs index 79f3a04fd..187d9fc0e 100644 --- a/warp-tls/Network/Wai/Handler/WarpTLS/Internal.hs +++ b/warp-tls/Network/Wai/Handler/WarpTLS/Internal.hs @@ -12,7 +12,6 @@ module Network.Wai.Handler.WarpTLS.Internal ( import qualified Data.ByteString as S import qualified Data.ByteString.Lazy as L -import Data.Default (def) import qualified Data.IORef as I import qualified Network.TLS as TLS import qualified Network.TLS.Extra as TLSExtra @@ -33,7 +32,7 @@ data CertSettings instance Show CertSettings where show (CertFromFile a b c) = "CertFromFile " ++ show a ++ " " ++ show b ++ " " ++ show c show (CertFromMemory a b c) = "CertFromMemory " ++ show a ++ " " ++ show b ++ " " ++ show c - show (CertFromRef _ _ _) = "CertFromRef" + show CertFromRef{} = "CertFromRef" ---------------------------------------------------------------- @@ -91,7 +90,7 @@ data TLSSettings = TLSSettings -- to take when a client certificate is received. See the "Network.TLS" -- module for details. -- - -- Default: def + -- Default: defaultServerHooks -- -- Since 3.0.2 , tlsServerDHEParams :: Maybe TLS.DHParams @@ -145,16 +144,16 @@ defaultTlsSettings = TLSSettings { certSettings = defaultCertSettings , onInsecure = DenyInsecure "This server only accepts secure HTTPS connections." - , tlsLogging = def - , tlsAllowedVersions = TLS.supportedVersions def + , tlsLogging = TLS.defaultLogging + , tlsAllowedVersions = TLS.supportedVersions TLS.defaultSupported , tlsCiphers = ciphers , tlsWantClientCert = False - , tlsServerHooks = def + , tlsServerHooks = TLS.defaultServerHooks , tlsServerDHEParams = Nothing , tlsSessionManagerConfig = Nothing , tlsCredentials = Nothing , tlsSessionManager = Nothing - , tlsSupportedHashSignatures = TLS.supportedHashSignatures def + , tlsSupportedHashSignatures = TLS.supportedHashSignatures TLS.defaultSupported } -- taken from stunnel example in tls-extra From 3ac218ed30ebf74ada008cb1d855796c7b4efe3b Mon Sep 17 00:00:00 2001 From: Felix Paulusma Date: Sun, 3 Nov 2024 13:30:13 +0100 Subject: [PATCH 2/5] bumped version and removed 'data-default' dependency. --- warp-tls/ChangeLog.md | 5 +++++ warp-tls/warp-tls.cabal | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/warp-tls/ChangeLog.md b/warp-tls/ChangeLog.md index 6bfab0804..bca80e07b 100644 --- a/warp-tls/ChangeLog.md +++ b/warp-tls/ChangeLog.md @@ -1,5 +1,10 @@ # ChangeLog +## 3.4.10 + +* Removed `data-default` dependency entirely. Does now require `>= tls-2.1.3`. + [#1011](https://github.com/yesodweb/wai/pull/1011) + ## 3.4.9 * Using `timeout` for `handshake` to prevent thread leaks. diff --git a/warp-tls/warp-tls.cabal b/warp-tls/warp-tls.cabal index edd55cbad..bd9a6c977 100644 --- a/warp-tls/warp-tls.cabal +++ b/warp-tls/warp-tls.cabal @@ -22,8 +22,7 @@ Library , bytestring >= 0.9 , wai >= 3.2 && < 3.3 , warp >= 3.3.29 && < 3.5 - , data-default - , tls >= 1.7 && < 2.2 + , tls >= 2.1.3 && < 2.2 , network >= 2.2.1 , streaming-commons , tls-session-manager >= 0.0.4 From 20d96e8b10c87a830d5b5bbe05580d566f5ae55a Mon Sep 17 00:00:00 2001 From: Felix Paulusma Date: Sun, 3 Nov 2024 14:21:53 +0100 Subject: [PATCH 3/5] fix ci? --- stack.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stack.yaml b/stack.yaml index 83a113b35..58b296eb8 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,4 @@ -resolver: lts-22.39 +resolver: lts-22.40 packages: - ./auto-update - ./mime-types @@ -29,7 +29,7 @@ extra-deps: - http3-0.0.16 - network-control-0.1.0 - network-udp-0.0.0 - - quic-0.2.3 + - quic-0.2.4 - sockaddr-0.0.1 - tls-2.1.3 - tls-session-manager-0.0.7 From 80b7baa8b228ff89db7dfffe8431d86ca569e044 Mon Sep 17 00:00:00 2001 From: Felix Paulusma Date: Sun, 3 Nov 2024 15:32:49 +0100 Subject: [PATCH 4/5] aaaand build nightly --- stack-nightly.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stack-nightly.yaml b/stack-nightly.yaml index 8942b80ed..ce3614bad 100644 --- a/stack-nightly.yaml +++ b/stack-nightly.yaml @@ -23,8 +23,12 @@ nix: - fcgi - zlib extra-deps: + - crypto-token-0.1.2 + - http-semantics-0.2.1 - http3-0.0.18 - network-udp-0.0.0 - - quic-0.2.3 + - quic-0.2.4 + - tls-2.1.3 + - tls-session-manager-0.0.7 - sockaddr-0.0.1 - tls-2.1.3 From ac5cf0804fcedebfcde678c75bc928f5b5482a33 Mon Sep 17 00:00:00 2001 From: Felix Paulusma Date: Wed, 6 Nov 2024 05:09:31 +0100 Subject: [PATCH 5/5] fixed CI wrt 'warp-quic' and added ChangeLog entry to 'wai-extra' --- stack-lts-19.yaml | 8 +++++++- stack-lts-20.yaml | 7 ++++++- stack-lts-21.yaml | 7 ++++++- stack-nightly.yaml | 1 - wai-extra/ChangeLog.md | 8 ++++++++ 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/stack-lts-19.yaml b/stack-lts-19.yaml index b7b9dbfcf..33046fca6 100644 --- a/stack-lts-19.yaml +++ b/stack-lts-19.yaml @@ -12,7 +12,7 @@ packages: - ./wai-http2-extra - ./wai-websockets - ./warp -# - ./warp-quic +- ./warp-quic - ./warp-tls flags: wai-extra: @@ -28,12 +28,18 @@ extra-deps: - crypton-1.0.1 - crypton-x509-1.7.7 - crypton-x509-store-1.6.9 + - crypton-x509-system-1.6.7 - crypton-x509-validation-1.6.12 + - fast-logger-3.2.5 - http-semantics-0.2.1 - http2-5.3.4 + - http3-0.0.18 - memory-0.18.0 + - network-3.1.4.0 - network-byte-order-0.1.7 - network-control-0.1.3 + - quic-0.2.4 + - sockaddr-0.0.1 - tls-2.1.3 - tls-session-manager-0.0.7 - unix-time-0.4.16 diff --git a/stack-lts-20.yaml b/stack-lts-20.yaml index 217a1a78f..4d49b85c9 100644 --- a/stack-lts-20.yaml +++ b/stack-lts-20.yaml @@ -12,7 +12,7 @@ packages: - ./wai-http2-extra - ./wai-websockets - ./warp -# - ./warp-quic +- ./warp-quic - ./warp-tls flags: wai-extra: @@ -28,13 +28,18 @@ extra-deps: - crypton-1.0.1 - crypton-x509-1.7.7 - crypton-x509-store-1.6.9 + - crypton-x509-system-1.6.7 - crypton-x509-validation-1.6.12 + - fast-logger-3.2.5 - http-semantics-0.2.1 - http2-5.3.4 + - http3-0.0.18 - memory-0.18.0 - multipart-0.2.1 - network-byte-order-0.1.7 - network-control-0.1.3 + - quic-0.2.4 + - sockaddr-0.0.1 - tls-2.1.3 - tls-session-manager-0.0.7 - unix-time-0.4.16 diff --git a/stack-lts-21.yaml b/stack-lts-21.yaml index 60b638e7e..f31bac134 100644 --- a/stack-lts-21.yaml +++ b/stack-lts-21.yaml @@ -12,7 +12,7 @@ packages: - ./wai-http2-extra - ./wai-websockets - ./warp -# - ./warp-quic +- ./warp-quic - ./warp-tls flags: wai-extra: @@ -27,9 +27,14 @@ extra-deps: - crypton-1.0.1 - crypton-x509-1.7.7 - crypton-x509-store-1.6.9 + - crypton-x509-system-1.6.7 - crypton-x509-validation-1.6.12 - http-semantics-0.2.1 - http2-5.3.4 + - http3-0.0.18 - network-control-0.1.3 + - quic-0.2.4 + - sockaddr-0.0.1 - tls-2.1.3 - tls-session-manager-0.0.7 + - unix-time-0.4.16 diff --git a/stack-nightly.yaml b/stack-nightly.yaml index ce3614bad..a9e1b5727 100644 --- a/stack-nightly.yaml +++ b/stack-nightly.yaml @@ -31,4 +31,3 @@ extra-deps: - tls-2.1.3 - tls-session-manager-0.0.7 - sockaddr-0.0.1 - - tls-2.1.3 diff --git a/wai-extra/ChangeLog.md b/wai-extra/ChangeLog.md index cd1092a2b..7e4a14638 100644 --- a/wai-extra/ChangeLog.md +++ b/wai-extra/ChangeLog.md @@ -1,5 +1,13 @@ # Changelog for wai-extra +## 3.1.17 + +* Started deprecation of `data-default` [#1011](https://github.com/yesodweb/wai/pull/1011) + * All `Default` instances have comments that these will be removed in a future major version. + * `def` exported from `Network.Wai.Middleware.Gzip` now has a deprecation warning + * All uses of `def` have been replaced with explicit `default{TYPE_NAME}` values. +* Some additional documentation + ## 3.1.16 * Substituted `data-default-class` for `data-default` [#1010](https://github.com/yesodweb/wai/pull/1010)