summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-06-01 07:23:27 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2011-06-01 07:23:27 -0400
commit3b35eef00de0ddd2fe05fb763fd6c62432e03c45 (patch)
treef829a12b4375dec19f7b6fb6a492a57112d73245 /src
parent9afb6fd5f83c777d8a340b0f428f20b769d04069 (diff)
Handle 'prefix' directives for HTTPS
Diffstat (limited to 'src')
-rw-r--r--src/settings.sml21
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