Slightly more efficient header construction

This commit is contained in:
Michael Snoyman 2012-11-25 21:45:08 +02:00
parent 918e3c9d2e
commit 0c4ded0fd1

View File

@ -522,12 +522,12 @@ runHandler handler mrender sroute tomr master sub upload log' =
Right c' -> return $ YARPlain status (appEndo headers []) ct c' finalSession
HCError e -> handleError e
HCRedirect status loc -> do
let disable_caching =
[ Header "Cache-Control" "no-cache, must-revalidate"
, Header "Expires" "Thu, 01 Jan 1970 05:05:05 GMT"
]
hs = (if status /= H.movedPermanently301 then disable_caching else [])
++ Header "Location" (encodeUtf8 loc) : appEndo headers []
let disable_caching x =
Header "Cache-Control" "no-cache, must-revalidate"
: Header "Expires" "Thu, 01 Jan 1970 05:05:05 GMT"
: x
hs = (if status /= H.movedPermanently301 then disable_caching else id)
$ Header "Location" (encodeUtf8 loc) : appEndo headers []
return $ YARPlain
status hs typePlain emptyContent
finalSession