on master help sign in
handling the case of no fd cache in HTTP/2.
commitb688d9b30e0b0b05813cc612ae03e64af112e04b authorKazu Yamamoto <kazu@iij.ad.jp> dateTue 17 Sep 2019, 11:23 (7 years ago) parentc8c8f11
1 file changed+6−2
warp/Network/Wai/Handler/Warp/HTTP2/File.hs+6−2
warp/Network/Wai/Handler/Warp/HTTP2/File.hs+6−2
@@ -15,8 +15,12 @@ import Network.Wai.Handler.Warp.SendFile (positionRead)
1515
1616pReadMaker :: InternalInfo -> PositionReadMaker
1717pReadMaker ii path = do
18− (Just fd, refresh) <- getFd ii path
19− return (pread fd, Refresher refresh)
18+ (mfd, refresh) <- getFd ii path
19+ case mfd of
20+ Just fd -> return (pread fd, Refresher refresh)
21+ Nothing -> do
22+ fd <- openFile path
23+ return (pread fd, Closer $ closeFile fd)
2024 where
2125 pread :: Fd -> PositionRead
2226 pread fd off bytes buf = fromIntegral <$> positionRead fd buf bytes' off'