X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FInteraction.hs;h=29c944e573bf8c41c1fbb2ca2cb00ba500181eab;hb=5b255535f2c7d2a6d4622ad164b31e63746b906e;hp=6045d97752e9551f1cf449da20939f60adb56e9e;hpb=34b0ad7f2ffc5e7ca67fa3468d01c5551edc8a8b;p=Lucu.git diff --git a/Network/HTTP/Lucu/Interaction.hs b/Network/HTTP/Lucu/Interaction.hs index 6045d97..29c944e 100644 --- a/Network/HTTP/Lucu/Interaction.hs +++ b/Network/HTTP/Lucu/Interaction.hs @@ -20,7 +20,7 @@ import qualified Data.ByteString.Lazy.Char8 as B import Data.ByteString.Lazy.Char8 (ByteString) import qualified Data.Sequence as S import Data.Sequence (Seq) -import Network +import Network.Socket import Network.HTTP.Lucu.Config import Network.HTTP.Lucu.HttpVersion import Network.HTTP.Lucu.Request @@ -28,9 +28,9 @@ import Network.HTTP.Lucu.Response data Interaction = Interaction { itrConfig :: Config - , itrRemoteHost :: HostName + , itrRemoteAddr :: SockAddr , itrResourcePath :: Maybe [String] - , itrRequest :: Maybe Request + , itrRequest :: TVar (Maybe Request) , itrResponse :: TVar Response -- FIXME: この三つは本來 TVar であるべきでないので、唯の Bool にす @@ -82,9 +82,10 @@ defaultPageContentType :: String defaultPageContentType = "application/xhtml+xml" -newInteraction :: Config -> HostName -> Maybe Request -> IO Interaction -newInteraction conf host req - = do responce <- newTVarIO $ Response { +newInteraction :: Config -> SockAddr -> Maybe Request -> IO Interaction +newInteraction conf addr req + = do request <- newTVarIO $ req + responce <- newTVarIO $ Response { resVersion = HttpVersion 1 1 , resStatus = Ok , resHeaders = [("Content-Type", defaultPageContentType)] @@ -116,9 +117,9 @@ newInteraction conf host req return $ Interaction { itrConfig = conf - , itrRemoteHost = host + , itrRemoteAddr = addr , itrResourcePath = Nothing - , itrRequest = req + , itrRequest = request , itrResponse = responce , itrRequestHasBody = requestHasBody