diff options
author | 2011-06-01 07:23:27 -0400 | |
---|---|---|
committer | 2011-06-01 07:23:27 -0400 | |
commit | 3175ee735c4f753a8e1d70f5a9f47206f5a44a75 (patch) | |
tree | f829a12b4375dec19f7b6fb6a492a57112d73245 | |
parent | 7c2552dfc3112f6828114de756566c264f5235cf (diff) |
Handle 'prefix' directives for HTTPS
-rw-r--r-- | src/settings.sml | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/settings.sml b/src/settings.sml index c60f5d60..69d67959 100644 --- a/src/settings.sml +++ b/src/settings.sml @@ -44,16 +44,21 @@ fun setUrlPrefix p = else p + fun findPrefix n = + let + val (befor, after) = Substring.splitl (fn ch => ch <> #"/") (Substring.extract (prefix, n, NONE)) + in + if Substring.isEmpty after then + ("", prefix) + else + (String.substring (prefix, 0, n) ^ Substring.string befor, Substring.string after) + end + val (prepre, prefix) = if String.isPrefix "http://" prefix then - let - val (befor, after) = Substring.splitl (fn ch => ch <> #"/") (Substring.extract (prefix, 7, NONE)) - in - if Substring.isEmpty after then - ("", prefix) - else - ("http://" ^ Substring.string befor, Substring.string after) - end + findPrefix 7 + else if String.isPrefix "https://" prefix then + findPrefix 8 else ("", prefix) in |