+make_https :: URL -> URL
+make_https url =
+ case parse_result of
+ Nothing -> url -- Shrug?
+ Just uri ->
+ if http uri then
+ show $ uri { uriScheme = "https:" }
+ else
+ url -- Leave non-http URLs alone.
+ where
+ parse_result = parseURIReference url
+
+
+add_trailing_slash :: URL -> URL
+add_trailing_slash url =
+ case parse_result of
+ Nothing -> url -- Shrug?
+ Just uri ->
+ let old_path = uriPath uri in
+ if (isSuffixOf "/" old_path) || (isSuffixOf "bigpage" old_path) then
+ -- It already had a trailing slash, or it's a 'bigpage' URL.
+ -- Trailing slashes after 'bigpage' don't work.
+ url
+ else
+ show $ uri { uriPath = old_path ++ "/" }
+ where
+ parse_result = parseURIReference url
+
+