X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FInteraction.hs;h=abc1cf550bca44dcfe692f275f35767b6aa8bedf;hb=4e41b11;hp=3be8928bf83a7edf473458c6760b06275b3cf886;hpb=a362be1c8664306b970c32e1df9b62081498feb1;p=Lucu.git diff --git a/Network/HTTP/Lucu/Interaction.hs b/Network/HTTP/Lucu/Interaction.hs index 3be8928..abc1cf5 100644 --- a/Network/HTTP/Lucu/Interaction.hs +++ b/Network/HTTP/Lucu/Interaction.hs @@ -109,7 +109,6 @@ mkSemanticallyInvalidInteraction ∷ Config → IO SemanticallyInvalidInteraction mkSemanticallyInvalidInteraction config@(Config {..}) (AugmentedRequest {..}) = do date ← getCurrentDate - -- FIXME: DRY let res = setHeader "Server" cnfServerSoftware $ setHeader "Date" date $ setHeader "Content-Type" defaultPageContentType $ @@ -148,6 +147,7 @@ data NormalInteraction , niWillDiscardBody ∷ !(TVar Bool) , niWillClose ∷ !(TVar Bool) , niResponseHasCType ∷ !(TVar Bool) + -- FIXME: use TBChan Builder (in stm-chans package) , niBodyToSend ∷ !(TMVar Builder) , niState ∷ !(TVar InteractionState) @@ -217,11 +217,12 @@ type InteractionQueue = TVar (Seq SomeInteraction) mkInteractionQueue ∷ IO InteractionQueue mkInteractionQueue = newTVarIO (∅) -setResponseStatus ∷ NormalInteraction → StatusCode → STM () +-- 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 = sc + resStatus = fromStatusCode sc } writeTVar niResponse res'