on master help sign in
add warp-debug flag

for not it prints out the stat exception

commitf001b4eb965dba76422388df57a28c5ae2af501a authorGreg Weber <greg@gregweber.info> dateWed 26 Mar 2014, 14:28 (13 years ago) parent8a0776a
2 files changed+12−1
warp/Network/Wai/Handler/Warp/Response.hs+5−1 warp/warp.cabal+7
warp/Network/Wai/Handler/Warp/Response.hs+5−1
@@ -215,7 +215,11 @@ sendRsp :: Connection
215215sendRsp conn ver s0 hs0 restore (RspFile path mPart mRange hook) = restore $ do
216216 ex <- fileRange s0 hs path mPart mRange
217217 case ex of
218− Left _ -> sendRsp conn ver s2 hs2 id (RspBuilder body True)
218+ Left _ex -> do
219+#ifdef WARP_DEBUG
220+ print _ex
221+#endif
222+ sendRsp conn ver s2 hs2 id (RspBuilder body True)
219223 Right (s, hs1, beg, len) -> do
220224 lheader <- composeHeader ver s hs1
221225 connSendFile conn path beg len hook [lheader]
warp/warp.cabal+7
@@ -31,6 +31,10 @@ Flag allow-sendfilefd
3131 Description: Allow use of sendfileFd (not available on GNU/kFreeBSD)
3232 Default: True
3333
34+Flag warp-debug
35+ Description: print debug output. not suitable for production
36+ Default: False
37+
3438Library
3539 Build-Depends: base >= 3 && < 5
3640 , array
@@ -77,6 +81,9 @@ Library
7781 Network.Wai.Handler.Warp.Types
7882 Paths_warp
7983 Ghc-Options: -Wall
84+
85+ if flag(warp-debug)
86+ Cpp-Options: -DWARP_DEBUG
8087 if (os(linux) || os(freebsd) || os(darwin)) && flag(allow-sendfilefd)
8188 Cpp-Options: -DSENDFILEFD
8289 Build-Depends: hashable