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-server".

The branch, master has been updated
       via  5720672e1ed87ed4cf4ebb889fdcb0b9d1eeccc1 (commit)
      from  cddc130cbd35fe470a66efeb5f3c702a967956f9 (commit)


Summary of changes:
 src/Snap/Internal/Http/Server.hs |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 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 5720672e1ed87ed4cf4ebb889fdcb0b9d1eeccc1
Author: Gregory Collins <[email protected]>
Date:   Thu Jun 3 03:44:59 2010 -0400

    HTTP spec says 304 responses must not contain ANY body; we think this is 
where our recent hang bug has been

diff --git a/src/Snap/Internal/Http/Server.hs b/src/Snap/Internal/Http/Server.hs
index 2c9b716..da9c13b 100644
--- a/src/Snap/Internal/Http/Server.hs
+++ b/src/Snap/Internal/Http/Server.hs
@@ -601,17 +601,29 @@ sendResponse rsp' writeEnd ibuf killBuffering onSendFile 
= do
             return $ r { rspContentLength = Just fs }
 
 
+    handle304 :: Response -> Response
+    handle304 r = setResponseBody (enumBS "") $
+                  updateHeaders (Map.delete "Transfer-Encoding") $
+                  setContentLength 0 r
+
     fixupResponse :: Response -> ServerMonad Response
     fixupResponse r =
         {-# SCC "fixupResponse" #-}
         do
             let r' = updateHeaders (Map.delete "Content-Length") r
-            r'' <- case (rspBody r') of
-                     (Enum _)     -> return r'
-                     (SendFile f) -> setFileSize f r'
-            case (rspContentLength r'') of
-              Nothing   -> noCL r''
-              (Just sz) -> hasCL sz r''
+
+            let code = rspStatus r'
+
+            let r'' = if code == 204 || code == 304
+                       then handle304 r'
+                       else r'
+
+            r''' <- case (rspBody r'') of
+                     (Enum _)     -> return r''
+                     (SendFile f) -> setFileSize f r''
+            case (rspContentLength r''') of
+              Nothing   -> noCL r'''
+              (Just sz) -> hasCL sz r'''
 
 
     bsshow = l2s . show
-----------------------------------------------------------------------


hooks/post-receive
-- 
snap-server
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to