import Network.HTTP.Lucu.Utils
import Network.URI hiding (path)
import System.IO
-import System.IO.Error hiding (catch)
import Prelude hiding (catch)
driftTo Done
) itr
)
- $ \ exc -> processException exc
+ processException
where
fork :: IO () -> IO ThreadId
- fork = if (resUsesNativeThread def)
+ fork = if resUsesNativeThread def
then forkOS
else forkIO
setHeader (C8.pack "Allow") (C8.pack $ joinWith ", " allowedMethods)
allowedMethods :: [String]
- allowedMethods = nub $ foldr (++) [] [ methods resGet ["GET"]
- , methods resHead ["GET", "HEAD"]
- , methods resPost ["POST"]
- , methods resPut ["PUT"]
- , methods resDelete ["DELETE"]
- ]
+ allowedMethods = nub $ concat [ methods resGet ["GET"]
+ , methods resHead ["GET", "HEAD"]
+ , methods resPost ["POST"]
+ , methods resPut ["PUT"]
+ , methods resDelete ["DELETE"]
+ ]
methods :: (ResourceDef -> Maybe a) -> [String] -> [String]
methods f xs = case f def of
if state <= DecidingHeader then
flip runRes itr
$ do setStatus $ aboStatus abo
- mapM_ (\ (name, value) -> setHeader name value) $ fromHeaders $ aboHeaders abo
+ mapM_ (uncurry setHeader) $ fromHeaders $ aboHeaders abo
output $ abortPage conf reqM res abo
else
when (cnfDumpTooLateAbortionToStderr $ itrConfig itr)
$ hPutStrLn stderr $ show abo
flip runRes itr $ driftTo Done
-
- formatIOE :: IOError -> String
- formatIOE ioE = if isUserError ioE then
- ioeGetErrorString ioE
- else
- show ioE