Mercurial > urweb
diff src/settings.sml @ 1465:2f5fd248588d
getHeader and setHeader
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sun, 29 May 2011 14:29:26 -0400 |
parents | 66092ce45a76 |
children | 5018878ca645 |
line wrap: on
line diff
--- a/src/settings.sml Sun May 29 13:31:53 2011 -0400 +++ b/src/settings.sml Sun May 29 14:29:26 2011 -0400 @@ -140,7 +140,9 @@ "debug", "naughtyDebug", "rand", - "now"] + "now", + "getHeader", + "setHeader"] val benign = ref benignBase fun setBenignEffectful ls = benign := S.addList (benignBase, ls) @@ -293,12 +295,18 @@ val url = ref ([] : rule list) val mime = ref ([] : rule list) +val request = ref ([] : rule list) +val response = ref ([] : rule list) fun setUrlRules ls = url := ls fun setMimeRules ls = mime := ls +fun setRequestHeaderRules ls = request := ls +fun setResponseHeaderRules ls = response := ls fun getUrlRules () = !url fun getMimeRules () = !mime +fun getRequestHeaderRules () = !request +fun getResponseHeaderRules () = !response fun check f rules s = let @@ -324,9 +332,12 @@ end val checkUrl = check (fn _ => true) url -val checkMime = check - (CharVector.all (fn ch => Char.isAlphaNum ch orelse ch = #"/" orelse ch = #"-" orelse ch = #".")) - mime + +val validMime = CharVector.all (fn ch => Char.isAlphaNum ch orelse ch = #"/" orelse ch = #"-" orelse ch = #".") + +val checkMime = check validMime mime +val checkRequestHeader = check validMime request +val checkResponseHeader = check validMime response type protocol = {