]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/Resource/Tree.hs
"driftTo Done" was trying to change the response header, which is impossible.
[Lucu.git] / Network / HTTP / Lucu / Resource / Tree.hs
index 6fc49d477891adfd16b80f37466f21d6d865d6f3..be51282c910ad11c78754190b7f96b35563a7d9a 100644 (file)
@@ -1,6 +1,5 @@
 module Network.HTTP.Lucu.Resource.Tree
     ( ResourceDef(..)
-    , Resource
     , ResTree
     , mkResTree    -- [ ([String], ResourceDef) ] -> ResTree
 
@@ -32,10 +31,10 @@ import           System.IO.Error hiding (catch)
 import           Prelude hiding (catch)
 
 
-{- /aaa/bbb/ccc にアクセスされた時、もし /aaa/bbb に貪欲なリソースがあ
-   れば、假に /aaa/bbb/ccc に何らかのリソースがあったとしても必ず
-   /aaa/bbb が撰ばれる。/aaa/bbb のリソースが貪欲でなければ、それは無視
-   される。 -}
+-- "/aaa/bbb/ccc" にアクセスされた時、もし "/aaa/bbb" に貪欲なリソース
+-- があれば、假に "/aaa/bbb/ccc" に何らかのリソースがあったとしても必ず
+-- "/aaa/bbb" が撰ばれる。"/aaa/bbb" のリソースが貪欲でなければ、それは
+-- 無視される。
 data ResourceDef = ResourceDef {
       resUsesNativeThread :: Bool
     , resIsGreedy         :: Bool
@@ -59,10 +58,10 @@ mkResTree list = processRoot list
                 children = processNonRoot nonRoots
             in
               if null roots then
-                  -- / にリソースが定義されない。/foo とかにはあるかも。
+                  -- "/" にリソースが定義されない。"/foo" とかにはあるかも。
                   ResNode Nothing children
               else
-                  -- / がある。
+                  -- "/" がある。
                   let (_, def) = last roots
                   in 
                     ResNode (Just def) children
@@ -174,15 +173,14 @@ runResource def itr
                -- を應答に反映させる餘地がある。さうでなければ stderr
                -- にでも吐くしか無い。
                state <- atomically $ readItr itr itrState id
-               resM  <- atomically $ readItr itr itrResponse id
+               res   <- atomically $ readItr itr itrResponse id
                if state <= DecidingHeader then
                    flip runReaderT itr
                       $ do setStatus $ aboStatus abo
                            -- FIXME: 同じ名前で複數の値があった時は、こ
                            -- れではまずいと思ふ。
                            mapM_ (\ (name, value) -> setHeader name value) $ aboHeaders abo
-                           setContentType ("application" +/+ "xhtml+xml")
-                           output $ abortPage conf reqM resM abo
+                           output $ abortPage conf reqM res abo
                  else
                    hPutStrLn stderr $ show abo