warp 3.1.6 → 3.1.7
raw patch · 6 files changed
+26/−8 lines, 6 files
Files
- ChangeLog.md +5/−0
- Network/Wai/Handler/Warp.hs +7/−0
- Network/Wai/Handler/Warp/HTTP2/HPACK.hs +7/−6
- Network/Wai/Handler/Warp/Run.hs +1/−1
- Network/Wai/Handler/Warp/Settings.hs +5/−0
- warp.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,8 @@+## 3.1.7++* A concatenated Cookie header is prepended to the headers to ensure that it flows pseudo headers. [#454](https://github.com/yesodweb/wai/pull/454)+* Providing a new settings: `setHTTP2Disabled` [#450](https://github.com/yesodweb/wai/pull/450)+ ## 3.1.6 * Adding back http-types 0.8 support [#449](https://github.com/yesodweb/wai/pull/449)
Network/Wai/Handler/Warp.hs view
@@ -76,6 +76,7 @@ , setProxyProtocolRequired , setProxyProtocolOptional , setSlowlorisSize+ , setHTTP2Disabled -- ** Getters , getPort , getHost@@ -355,6 +356,12 @@ -- Since 3.1.2 setSlowlorisSize :: Int -> Settings -> Settings setSlowlorisSize x y = y { settingsSlowlorisSize = x }++-- | Disable HTTP2.+--+-- Since 3.1.7+setHTTP2Disabled :: Settings -> Settings+setHTTP2Disabled y = y { settingsHTTP2Enabled = False } -- | Explicitly pause the slowloris timeout. --
Network/Wai/Handler/Warp/HTTP2/HPACK.hs view
@@ -10,7 +10,6 @@ import qualified Data.ByteString.Char8 as B8 import Data.CaseInsensitive (foldedCase) import Data.IORef (readIORef, writeIORef)-import qualified Data.List as L import Network.HPACK import qualified Network.HTTP.Types as H import Network.HTTP2@@ -63,9 +62,11 @@ -- >>> concatCookie [("foo","bar")] -- [("foo","bar")] -- >>> concatCookie [("cookie","a=b"),("foo","bar"),("cookie","c=d"),("cookie","e=f")]--- [("cookie","a=b; c=d; e=f"),("foo","bar")]+-- [("foo","bar"),("cookie","a=b; c=d; e=f")] concatCookie :: HeaderList -> HeaderList-concatCookie hdr = case L.partition (\x -> fst x == "cookie") hdr of- ([],_) -> hdr- (cookies,others) -> let cookieValue = B.intercalate "; " (map snd cookies)- in ("cookie",cookieValue) : others+concatCookie = collect []+ where+ collect cookies (("cookie",c):rest) = collect (cookies ++ [c]) rest+ collect cookies (h:rest) = h : collect cookies rest+ collect [] [] = []+ collect cookies [] = [("cookie", B.intercalate "; " cookies)]
Network/Wai/Handler/Warp/Run.hs view
@@ -387,7 +387,7 @@ return (True, bs0) else return (False, bs0)- if h2 then do+ if settingsHTTP2Enabled settings && h2 then do recvN <- makeReceiveN bs (connRecv conn) (connRecvBuf conn) -- fixme: origAddr http2 conn ii origAddr transport settings recvN app2
Network/Wai/Handler/Warp/Settings.hs view
@@ -92,6 +92,10 @@ -- ^ Size of bytes read to prevent Slowloris protection. Default value: 2048 -- -- Since 3.1.2.+ , settingsHTTP2Enabled :: Bool+ -- ^ Whether to enable HTTP2 ALPN/upgrades. Default: True+ --+ -- Since 3.1.7. } -- | Specify usage of the PROXY protocol.@@ -123,6 +127,7 @@ , settingsMaximumBodyFlush = Just 8192 , settingsProxyProtocol = ProxyProtocolNone , settingsSlowlorisSize = 2048+ , settingsHTTP2Enabled = True } -- | Apply the logic provided by 'defaultOnException' to determine if an
warp.cabal view
@@ -1,5 +1,5 @@ Name: warp-Version: 3.1.6+Version: 3.1.7 Synopsis: A fast, light-weight web server for WAI applications. License: MIT License-file: LICENSE