X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FInteraction.hs;h=6aee0f7296ac6bf0ff34da081e3f3413a8e72653;hb=b495d6b8b7647b719eceef2f3e50d5bf87c430cf;hp=018ee00d0eaa65e197c508a8d8d7c968d2fb3fe2;hpb=874e6a4cc1229d29f1d902f36482cf0f78e30c9f;p=Lucu.git diff --git a/Network/HTTP/Lucu/Interaction.hs b/Network/HTTP/Lucu/Interaction.hs index 018ee00..6aee0f7 100644 --- a/Network/HTTP/Lucu/Interaction.hs +++ b/Network/HTTP/Lucu/Interaction.hs @@ -9,6 +9,7 @@ module Network.HTTP.Lucu.Interaction ( Interaction(..) , SomeInteraction(..) + , EndOfInteraction(..) , SyntacticallyInvalidInteraction(..) , mkSyntacticallyInvalidInteraction @@ -24,7 +25,6 @@ module Network.HTTP.Lucu.Interaction , InteractionQueue , mkInteractionQueue - , setResponseStatus , getCurrentDate ) where @@ -64,6 +64,13 @@ instance Interaction SomeInteraction where toInteraction = id fromInteraction = Just +-- |'EndOfInteraction' is an 'Interaction' indicating the end of +-- (possibly pipelined) requests. The connection has already been +-- closed so no need to reply anything. +data EndOfInteraction = EndOfInteraction + deriving Typeable +instance Interaction EndOfInteraction + -- |'SyntacticallyInvalidInteraction' is an 'Interaction' without even -- a syntactically valid 'Request'. The response code will always be -- 'BadRequest'. @@ -230,14 +237,5 @@ type InteractionQueue = TVar (Seq SomeInteraction) mkInteractionQueue ∷ IO InteractionQueue mkInteractionQueue = newTVarIO (∅) --- FIXME: Response.hs should provide setStatus ∷ sc → Response → Response -setResponseStatus ∷ StatusCode sc ⇒ NormalInteraction → sc → STM () -setResponseStatus (NI {..}) sc - = do res ← readTVar niResponse - let res' = res { - resStatus = fromStatusCode sc - } - writeTVar niResponse res' - getCurrentDate ∷ IO Ascii getCurrentDate = HTTP.toAscii <$> getCurrentTime