Mercurial > urweb
comparison src/settings.sml @ 855:28e42b22424d
Initial implementation of protocols in Settings
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 23 Jun 2009 15:56:04 -0400 |
parents | 6725d73c3c31 |
children | 86ec89baee01 |
comparison
equal
deleted
inserted
replaced
854:158d980889ac | 855:28e42b22424d |
---|---|
246 val checkUrl = check (fn _ => true) url | 246 val checkUrl = check (fn _ => true) url |
247 val checkMime = check | 247 val checkMime = check |
248 (CharVector.all (fn ch => Char.isAlphaNum ch orelse ch = #"/" orelse ch = #"-" orelse ch = #".")) | 248 (CharVector.all (fn ch => Char.isAlphaNum ch orelse ch = #"/" orelse ch = #"-" orelse ch = #".")) |
249 mime | 249 mime |
250 | 250 |
251 | |
252 type protocol = { | |
253 name : string, | |
254 link : string, | |
255 supportsPush : bool | |
256 } | |
257 val protocols = ref ([] : protocol list) | |
258 fun addProtocol p = protocols := p :: !protocols | |
259 fun getProtocol s = List.find (fn p => #name p = s) (!protocols) | |
260 | |
261 fun clibFile s = OS.Path.joinDirFile {dir = Config.libC, | |
262 file = s} | |
263 | |
264 val http = {name = "http", | |
265 link = clibFile "request.o" ^ " " ^ clibFile "http.o", | |
266 supportsPush = true} | |
267 | |
268 val () = addProtocol http | |
269 | |
270 val curProto = ref http | |
271 fun setProtocol p = curProto := p | |
272 fun currentProtocol () = !curProto | |
273 | |
251 end | 274 end |