on master help sign in
handling the case of no fd cache in HTTP/2.
b688d9bKazu Yamamoto
warp/Network/Wai/Handler/Warp/HTTP2/File.hs+6−2
@@ -15,8 +15,12 @@ import Network.Wai.Handler.Warp.SendFile (positionRead)
15
15
16pReadMaker :: InternalInfo -> PositionReadMaker
16pReadMaker :: InternalInfo -> PositionReadMaker
17pReadMaker ii path = do
17pReadMaker ii path = do
18− (Just fd, refresh) <- getFd ii path
18+ (mfd, refresh) <- getFd ii path
19+ case mfd of
19− return (pread fd, Refresher refresh)
20+ Just fd -> return (pread fd, Refresher refresh)
21+ Nothing -> do
22+ fd <- openFile path
23+ return (pread fd, Closer $ closeFile fd)
20 where
24 where
21 pread :: Fd -> PositionRead
25 pread :: Fd -> PositionRead
22 pread fd off bytes buf = fromIntegral <$> positionRead fd buf bytes' off'
26 pread fd off bytes buf = fromIntegral <$> positionRead fd buf bytes' off'