add warp-debug flag

for not it prints out the stat exception
This commit is contained in:
Greg Weber 2014-03-26 14:28:58 -07:00
parent 8a0776a581
commit f001b4eb96
2 changed files with 12 additions and 1 deletions

View File

@ -215,7 +215,11 @@ sendRsp :: Connection
sendRsp conn ver s0 hs0 restore (RspFile path mPart mRange hook) = restore $ do
ex <- fileRange s0 hs path mPart mRange
case ex of
Left _ -> sendRsp conn ver s2 hs2 id (RspBuilder body True)
Left _ex -> do
#ifdef WARP_DEBUG
print _ex
#endif
sendRsp conn ver s2 hs2 id (RspBuilder body True)
Right (s, hs1, beg, len) -> do
lheader <- composeHeader ver s hs1
connSendFile conn path beg len hook [lheader]

View File

@ -31,6 +31,10 @@ Flag allow-sendfilefd
Description: Allow use of sendfileFd (not available on GNU/kFreeBSD)
Default: True
Flag warp-debug
Description: print debug output. not suitable for production
Default: False
Library
Build-Depends: base >= 3 && < 5
, array
@ -77,6 +81,9 @@ Library
Network.Wai.Handler.Warp.Types
Paths_warp
Ghc-Options: -Wall
if flag(warp-debug)
Cpp-Options: -DWARP_DEBUG
if (os(linux) || os(freebsd) || os(darwin)) && flag(allow-sendfilefd)
Cpp-Options: -DSENDFILEFD
Build-Depends: hashable