summaryrefslogtreecommitdiff
path: root/src/settings.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-06-23 15:56:04 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-06-23 15:56:04 -0400
commita4717bf85434747f0e96aa11030ce0869db2706c (patch)
tree5c08087fd98403edb3500ac4399ddece25c667ad /src/settings.sml
parentca88628fbeb6fe8cadf9d7e12e5faccf2a7da96b (diff)
Initial implementation of protocols in Settings
Diffstat (limited to 'src/settings.sml')
-rw-r--r--src/settings.sml23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/settings.sml b/src/settings.sml
index 9c7b1175..75c879f7 100644
--- a/src/settings.sml
+++ b/src/settings.sml
@@ -248,4 +248,27 @@ val checkMime = check
(CharVector.all (fn ch => Char.isAlphaNum ch orelse ch = #"/" orelse ch = #"-" orelse ch = #"."))
mime
+
+type protocol = {
+ name : string,
+ link : string,
+ supportsPush : bool
+}
+val protocols = ref ([] : protocol list)
+fun addProtocol p = protocols := p :: !protocols
+fun getProtocol s = List.find (fn p => #name p = s) (!protocols)
+
+fun clibFile s = OS.Path.joinDirFile {dir = Config.libC,
+ file = s}
+
+val http = {name = "http",
+ link = clibFile "request.o" ^ " " ^ clibFile "http.o",
+ supportsPush = true}
+
+val () = addProtocol http
+
+val curProto = ref http
+fun setProtocol p = curProto := p
+fun currentProtocol () = !curProto
+
end