- fun checkSsl host =
- case String.fields (fn ch => ch = #".") host of
- first::rest =>
- (case String.fields (fn ch => ch = #"_") first of
- [first, "ssl"] => {ssl = true, hostname = String.concatWith "." (first::rest),
- id = host}
- | _ => {ssl = false, hostname = host, id = host})
- | _ => {ssl = false, hostname = host, id = host}
+ fun checkSsl (node, host) =
+ let
+ val id = case String.tokens (fn ch => ch = #".") host of
+ [] => node ^ "/" ^ host
+ | first :: rest =>
+ case rev (String.tokens (fn ch => ch = #"_") first) of
+ "ssl" :: rest' => node ^ "/" ^ String.concatWith "_" (rev rest')
+ ^ "." ^ String.concatWith "." rest ^ ".ssl"
+ | _ => node ^ "/" ^ host
+ in
+ case String.fields (fn ch => ch = #".") host of
+ first::rest =>
+ (case String.fields (fn ch => ch = #"_") first of
+ [first, "ssl"] => {ssl = true, hostname = String.concatWith "." (first::rest),
+ id = id}
+ | _ => {ssl = false, hostname = host, id = id})
+ | _ => {ssl = false, hostname = host, id = id}
+ end