on master help sign in
setting isSecure of HTTP/2 correctly.
commiteb33f4b6d0cd316be4bcd811337c9350cca34a2c authorKazu Yamamoto <kazu@iij.ad.jp> dateTue 5 Nov 2019, 16:00 (7 years ago) parentfe8410b
3 files changed+10−9
warp/Network/Wai/Handler/Warp/HTTP2.hs+4−3 warp/Network/Wai/Handler/Warp/HTTP2/Request.hs+5−5 warp/Network/Wai/Handler/Warp/Run.hs+1−1
warp/Network/Wai/Handler/Warp/HTTP2.hs+4−3
@@ -24,8 +24,8 @@ import Network.Wai.Handler.Warp.Types
2424
2525----------------------------------------------------------------
2626
27−http2 :: Connection -> InternalInfo -> SockAddr -> S.Settings -> (BufSize -> IO ByteString) -> Application -> IO ()
28−http2 conn ii addr settings readN app =
27+http2 :: Connection -> Transport -> InternalInfo -> SockAddr -> S.Settings -> (BufSize -> IO ByteString) -> Application -> IO ()
28+http2 conn transport ii addr settings readN app =
2929 H2.run conf http2server
3030 where
3131 conf = H2.Config {
@@ -63,12 +63,13 @@ http2 conn ii addr settings readN app =
6363 logResponse h2rsp' req
6464 return ()
6565
66− toWAIRequest h2req aux = toRequest ii settings addr hdr bdylen bdy th
66+ toWAIRequest h2req aux = toRequest ii settings addr hdr bdylen bdy th secure
6767 where
6868 !hdr = H2.requestHeaders h2req
6969 !bdy = H2.getRequestBodyChunk h2req
7070 !bdylen = H2.requestBodySize h2req
7171 !th = H2.auxTimeHandle aux
72+ !secure = isTransportSecure transport
7273
7374 logResponse h2rsp req = logger req st msiz
7475 where
warp/Network/Wai/Handler/Warp/HTTP2/Request.hs+5−5
@@ -26,19 +26,19 @@ import Network.Wai.Handler.Warp.Request (getFileInfoKey, pauseTimeoutKey)
2626import qualified Network.Wai.Handler.Warp.Settings as S (Settings, settingsNoParsePath)
2727import Network.Wai.Handler.Warp.Types
2828
29−type ToReq = (TokenHeaderList,ValueTable) -> Maybe Int -> IO ByteString -> T.Handle -> IO Request
29+type ToReq = (TokenHeaderList,ValueTable) -> Maybe Int -> IO ByteString -> T.Handle -> Bool -> IO Request
3030
3131----------------------------------------------------------------
3232
3333toRequest :: InternalInfo -> S.Settings -> SockAddr -> ToReq
34−toRequest ii settings addr ht bodylen body th = do
34+toRequest ii settings addr ht bodylen body th secure = do
3535 ref <- newIORef Nothing
36− toRequest' ii settings addr ref ht bodylen body th
36+ toRequest' ii settings addr ref ht bodylen body th secure
3737
3838toRequest' :: InternalInfo -> S.Settings -> SockAddr
3939 -> IORef (Maybe HTTP2Data)
4040 -> ToReq
41−toRequest' ii settings addr ref (reqths,reqvt) bodylen body th = return req
41+toRequest' ii settings addr ref (reqths,reqvt) bodylen body th secure = return req
4242 where
4343 !req = Request {
4444 requestMethod = colonMethod
@@ -48,7 +48,7 @@ toRequest' ii settings addr ref (reqths,reqvt) bodylen body th = return req
4848 , rawQueryString = query
4949 , queryString = H.parseQuery query
5050 , requestHeaders = headers
51− , isSecure = True
51+ , isSecure = secure
5252 , remoteHost = addr
5353 , requestBody = body
5454 , vault = vaultValue
warp/Network/Wai/Handler/Warp/Run.hs+1−1
@@ -344,7 +344,7 @@ serveConnection conn ii th origAddr transport settings app = do
344344 let recvN = wrappedRecvN th istatus (settingsSlowlorisSize settings) rawRecvN
345345 -- fixme: origAddr
346346 checkTLS
347− http2 conn ii origAddr settings recvN app
347+ http2 conn transport ii origAddr settings recvN app
348348 else do
349349 src <- mkSource (wrappedRecv conn th istatus (settingsSlowlorisSize settings))
350350 writeIORef istatus True