@@ -2,6 +2,8 @@ module Network.Cgi
22
33import System
44
5+%default total
6+
57public
68Vars : Type
79Vars = List (String, String)
@@ -106,14 +108,11 @@ getVars seps query = mapMaybe readVar (split (\x => elem x seps) query)
106108 | _ = Nothing
107109
108110getContent : Int -> IO String
109−getContent x = getC x "" where
110− %assert_total
111− getC : Int -> String -> IO String
112− getC 0 acc = return $ reverse acc
113− getC n acc = if (n > 0)
114− then do x <- getChar
115− getC (n-1) (strCons x acc)
116− else (return "")
111+getContent x = getC (toNat x) "" where
112+ getC : Nat -> String -> IO String
113+ getC Z acc = return $ reverse acc
114+ getC (S k) acc = do x <- getChar
115+ getC k (strCons x acc)
117116
118117getCgiEnv : String -> IO String
119118getCgiEnv key = do