# HG changeset patch # User Adam Chlipala # Date 1306927407 14400 # Node ID 5018878ca64532159bee84e5bf4f27be72ba9164 # Parent a354b306f948d09794d64474ad866ce64e9bf5f5 Handle 'prefix' directives for HTTPS diff -r a354b306f948 -r 5018878ca645 src/settings.sml --- a/src/settings.sml Tue May 31 09:14:03 2011 -0400 +++ b/src/settings.sml Wed Jun 01 07:23:27 2011 -0400 @@ -44,16 +44,21 @@ 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