This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "snap-core".
The branch, master has been updated
via e3d5f5a18267df03f5fa8ef8e7dea5cdffed65f1 (commit)
from 8e704583a4bd38d34011244a024440371b404541 (commit)
Summary of changes:
src/Snap/Util/FileUploads.hs | 8 +++-----
test/suite/Snap/Util/FileUploads/Tests.hs | 8 ++++++--
2 files changed, 9 insertions(+), 7 deletions(-)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit e3d5f5a18267df03f5fa8ef8e7dea5cdffed65f1
Author: Gregory Collins <[email protected]>
Date: Sun Mar 20 17:14:29 2011 +0100
Fix a small bug in file uploads re: rate-limiting
diff --git a/src/Snap/Util/FileUploads.hs b/src/Snap/Util/FileUploads.hs
index 6199144..11ad19a 100644
--- a/src/Snap/Util/FileUploads.hs
+++ b/src/Snap/Util/FileUploads.hs
@@ -256,20 +256,18 @@ handleMultipart uploadPolicy origPartHandler = do
"got multipart/form-data without boundary"
let boundary = fromJust mbBoundary
- captures <- runRequestBody (iter bumpTimeout boundary partHandler `catch`
- errHandler)
+ captures <- runRequestBody (iter bumpTimeout boundary partHandler)
procCaptures [] captures
where
- iter bump boundary ph = killIfTooSlow
+ iter bump boundary ph = iterateeDebugWrapper "killIfTooSlow" $
+ killIfTooSlow
bump
(minimumUploadRate uploadPolicy)
(minimumUploadSeconds uploadPolicy)
(internalHandleMultipart boundary ph)
- errHandler (e :: SomeException) = skipToEof >> (lift $ throw e)
-
ins k v = Map.insertWith' (\a b -> Prelude.head a : b) k [v]
maxFormVars = maximumNumberOfFormInputs uploadPolicy
diff --git a/test/suite/Snap/Util/FileUploads/Tests.hs
b/test/suite/Snap/Util/FileUploads/Tests.hs
index 4151869..4464392 100644
--- a/test/suite/Snap/Util/FileUploads/Tests.hs
+++ b/test/suite/Snap/Util/FileUploads/Tests.hs
@@ -27,6 +27,8 @@ import Test.Framework.Providers.HUnit
import Test.HUnit hiding (Test, path)
------------------------------------------------------------------------------
import Snap.Internal.Http.Types
+import Snap.Internal.Debug
+import Snap.Internal.Iteratee.Debug
import Snap.Internal.Types
import Snap.Util.FileUploads
import Snap.Iteratee hiding (map)
@@ -354,7 +356,7 @@ goSlowEnumerator :: Snap a -> ByteString -> IO Response
goSlowEnumerator m s = do
rq <- mkRequest s
writeIORef (rqBody rq) $ SomeEnumerator slowEnum
- mx <- timeout (6*seconds) (liftM snd (run_ $ runIt m rq))
+ mx <- timeout (20*seconds) (liftM snd (run_ $ runIt m rq))
maybe (error "timeout") return mx
where
@@ -364,9 +366,11 @@ goSlowEnumerator m s = do
goo (Continue k) [] = k EOF
goo (Continue k) (x:xs) = do
+ debug $ "goSlowEnumerator: sending " ++ show x
step <- lift $ runIteratee $ k $ Chunks [ S.pack (x:[]) ]
liftIO waitabit
goo step xs
+ goo (Error e) _ = throwError e
goo _ _ = error "impossible"
@@ -381,7 +385,7 @@ seconds = (10::Int) ^ (6::Int)
------------------------------------------------------------------------------
runIt :: Snap a -> Request -> Iteratee ByteString IO (Request, Response)
-runIt m rq = runSnap m d d rq
+runIt m rq = iterateeDebugWrapper "test" $ runSnap m d d rq
where
d :: forall a . Show a => a -> IO ()
d = \x -> show x `deepseq` return ()
-----------------------------------------------------------------------
hooks/post-receive
--
snap-core
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap