From 4d1a1cf5107cda49490bcdca5fb9e9c7f401cbe7 Mon Sep 17 00:00:00 2001 From: Felix Paulusma Date: Thu, 4 Jan 2024 05:01:09 +0100 Subject: [PATCH] warp-tls: when making multiline strings, the first '\' on a new line doesn't escape the next character, it's the start of the next part of the string --- warp-tls/Network/Wai/Handler/WarpTLS.hs | 6 +++--- warp/Network/Wai/Handler/Warp/HTTP2/PushPromise.hs | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/warp-tls/Network/Wai/Handler/WarpTLS.hs b/warp-tls/Network/Wai/Handler/WarpTLS.hs index d334e9ccb..3bd94638a 100644 --- a/warp-tls/Network/Wai/Handler/WarpTLS.hs +++ b/warp-tls/Network/Wai/Handler/WarpTLS.hs @@ -428,9 +428,9 @@ plainHTTP TLSSettings{..} set s bs0 = case onInsecure of -- FIXME: Content-Length: -- FIXME: TLS/ sendAll s "HTTP/1.1 426 Upgrade Required\ - \r\nUpgrade: TLS/1.0, HTTP/1.1\ - \r\nConnection: Upgrade\ - \r\nContent-Type: text/plain\r\n\r\n" + \\r\nUpgrade: TLS/1.0, HTTP/1.1\ + \\r\nConnection: Upgrade\ + \\r\nContent-Type: text/plain\r\n\r\n" mapM_ (sendAll s) $ L.toChunks lbs close s throwIO InsecureConnectionDenied diff --git a/warp/Network/Wai/Handler/Warp/HTTP2/PushPromise.hs b/warp/Network/Wai/Handler/Warp/HTTP2/PushPromise.hs index 04d9e371a..78c21aa04 100644 --- a/warp/Network/Wai/Handler/Warp/HTTP2/PushPromise.hs +++ b/warp/Network/Wai/Handler/Warp/HTTP2/PushPromise.hs @@ -17,9 +17,7 @@ import Network.Wai.Handler.Warp.Types fromPushPromises :: InternalInfo -> Request -> IO [H2.PushPromise] fromPushPromises ii req = do mh2data <- getHTTP2Data req - let pp = case mh2data of - Nothing -> [] - Just h2data -> http2dataPushPromise h2data + let pp = maybe [] http2dataPushPromise mh2data catMaybes <$> mapM (fromPushPromise ii) pp fromPushPromise :: InternalInfo -> PushPromise -> IO (Maybe H2.PushPromise)