diff src/settings.sml @ 1799:3d922a28370b

Basis.getenv
author Adam Chlipala <adam@chlipala.net>
date Thu, 02 Aug 2012 16:33:25 -0400
parents 2f8b8952fe27
children 3c56aa6a0f55
line wrap: on
line diff
--- a/src/settings.sml	Sun Jul 29 12:54:17 2012 -0400
+++ b/src/settings.sml	Thu Aug 02 16:33:25 2012 -0400
@@ -400,16 +400,19 @@
 val mime = ref ([] : rule list)
 val request = ref ([] : rule list)
 val response = ref ([] : rule list)
+val env = ref ([] : rule list)
 
 fun setUrlRules ls = url := ls
 fun setMimeRules ls = mime := ls
 fun setRequestHeaderRules ls = request := ls
 fun setResponseHeaderRules ls = response := ls
+fun setEnvVarRules ls = env := ls
 
 fun getUrlRules () = !url
 fun getMimeRules () = !mime
 fun getRequestHeaderRules () = !request
 fun getResponseHeaderRules () = !response
+fun getEnvVarRules () = !env
 
 fun check f rules s =
     let
@@ -437,10 +440,12 @@
 val checkUrl = check (fn _ => true) url
 
 val validMime = CharVector.all (fn ch => Char.isAlphaNum ch orelse ch = #"/" orelse ch = #"-" orelse ch = #".")
+val validEnv = CharVector.all (fn ch => Char.isAlphaNum ch orelse ch = #"_" orelse ch = #".")
 
 val checkMime = check validMime mime
 val checkRequestHeader = check validMime request
 val checkResponseHeader = check validMime response
+val checkEnvVar = check validEnv env
 
 
 type protocol = {