Mercurial > urweb
diff src/mono_opt.sml @ 1065:217eb87dde31
Basis.url and redirects
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 10 Dec 2009 13:32:09 -0500 |
parents | 03a81e26e5fe |
children | 51e596feec37 |
line wrap: on
line diff
--- a/src/mono_opt.sml Thu Dec 10 12:06:03 2009 -0500 +++ b/src/mono_opt.sml Thu Dec 10 13:32:09 2009 -0500 @@ -115,6 +115,8 @@ doChars (String.explode s, []) end +fun checkUrl s = CharVector.all Char.isGraph s andalso Settings.checkUrl s + fun exp e = case e of EPrim (Prim.String s) => @@ -405,11 +407,16 @@ optExp (EApp (e2, e1), loc) | EFfiApp ("Basis", "bless", [(se as EPrim (Prim.String s), loc)]) => - (if Settings.checkUrl s then + (if checkUrl s then () else ErrorMsg.errorAt loc ("Invalid URL " ^ s ^ " passed to 'bless'"); se) + | EFfiApp ("Basis", "checkUrl", [(se as EPrim (Prim.String s), loc)]) => + (if checkUrl s then + ESome ((TFfi ("Basis", "string"), loc), (se, loc)) + else + ENone (TFfi ("Basis", "string"), loc)) | EFfiApp ("Basis", "blessMime", [(se as EPrim (Prim.String s), loc)]) => (if Settings.checkMime s then ()