comparison src/compiler.sml @ 1465:2f5fd248588d

getHeader and setHeader
author Adam Chlipala <adam@chlipala.net>
date Sun, 29 May 2011 14:29:26 -0400
parents 3d5e4c5fb6ee
children d40066b38710
comparison
equal deleted inserted replaced
1464:969b90b1f2f9 1465:2f5fd248588d
53 serverOnly : Settings.ffi list, 53 serverOnly : Settings.ffi list,
54 jsFuncs : (Settings.ffi * string) list, 54 jsFuncs : (Settings.ffi * string) list,
55 rewrites : Settings.rewrite list, 55 rewrites : Settings.rewrite list,
56 filterUrl : Settings.rule list, 56 filterUrl : Settings.rule list,
57 filterMime : Settings.rule list, 57 filterMime : Settings.rule list,
58 filterRequest : Settings.rule list,
59 filterResponse : Settings.rule list,
58 protocol : string option, 60 protocol : string option,
59 dbms : string option, 61 dbms : string option,
60 sigFile : string option, 62 sigFile : string option,
61 safeGets : string list, 63 safeGets : string list,
62 onError : (string * string list * string) option, 64 onError : (string * string list * string) option,
333 Settings.setServerOnly (#serverOnly job); 335 Settings.setServerOnly (#serverOnly job);
334 Settings.setJsFuncs (#jsFuncs job); 336 Settings.setJsFuncs (#jsFuncs job);
335 Settings.setRewriteRules (#rewrites job); 337 Settings.setRewriteRules (#rewrites job);
336 Settings.setUrlRules (#filterUrl job); 338 Settings.setUrlRules (#filterUrl job);
337 Settings.setMimeRules (#filterMime job); 339 Settings.setMimeRules (#filterMime job);
340 Settings.setRequestHeaderRules (#filterRequest job);
341 Settings.setResponseHeaderRules (#filterResponse job);
338 Option.app Settings.setProtocol (#protocol job); 342 Option.app Settings.setProtocol (#protocol job);
339 Option.app Settings.setDbms (#dbms job); 343 Option.app Settings.setDbms (#dbms job);
340 Settings.setSafeGets (#safeGets job); 344 Settings.setSafeGets (#safeGets job);
341 Settings.setOnError (#onError job); 345 Settings.setOnError (#onError job);
342 Settings.setMinHeap (#minHeap job); 346 Settings.setMinHeap (#minHeap job);
382 rewrites = [{pkind = Settings.Any, 386 rewrites = [{pkind = Settings.Any,
383 kind = Settings.Prefix, 387 kind = Settings.Prefix,
384 from = capitalize (OS.Path.file fname) ^ "/", to = ""}], 388 from = capitalize (OS.Path.file fname) ^ "/", to = ""}],
385 filterUrl = [], 389 filterUrl = [],
386 filterMime = [], 390 filterMime = [],
391 filterRequest = [],
392 filterResponse = [],
387 protocol = NONE, 393 protocol = NONE,
388 dbms = NONE, 394 dbms = NONE,
389 sigFile = NONE, 395 sigFile = NONE,
390 safeGets = [], 396 safeGets = [],
391 onError = NONE, 397 onError = NONE,
495 val serverOnly = ref [] 501 val serverOnly = ref []
496 val jsFuncs = ref [] 502 val jsFuncs = ref []
497 val rewrites = ref [] 503 val rewrites = ref []
498 val url = ref [] 504 val url = ref []
499 val mime = ref [] 505 val mime = ref []
506 val request = ref []
507 val response = ref []
500 val libs = ref [] 508 val libs = ref []
501 val protocol = ref NONE 509 val protocol = ref NONE
502 val dbms = ref NONE 510 val dbms = ref NONE
503 val sigFile = ref (Settings.getSigFile ()) 511 val sigFile = ref (Settings.getSigFile ())
504 val safeGets = ref [] 512 val safeGets = ref []
527 serverOnly = rev (!serverOnly), 535 serverOnly = rev (!serverOnly),
528 jsFuncs = rev (!jsFuncs), 536 jsFuncs = rev (!jsFuncs),
529 rewrites = rev (!rewrites), 537 rewrites = rev (!rewrites),
530 filterUrl = rev (!url), 538 filterUrl = rev (!url),
531 filterMime = rev (!mime), 539 filterMime = rev (!mime),
540 filterRequest = rev (!request),
541 filterResponse = rev (!response),
532 sources = sources, 542 sources = sources,
533 protocol = !protocol, 543 protocol = !protocol,
534 dbms = !dbms, 544 dbms = !dbms,
535 sigFile = !sigFile, 545 sigFile = !sigFile,
536 safeGets = rev (!safeGets), 546 safeGets = rev (!safeGets),
571 serverOnly = #serverOnly old @ #serverOnly new, 581 serverOnly = #serverOnly old @ #serverOnly new,
572 jsFuncs = #jsFuncs old @ #jsFuncs new, 582 jsFuncs = #jsFuncs old @ #jsFuncs new,
573 rewrites = #rewrites old @ #rewrites new, 583 rewrites = #rewrites old @ #rewrites new,
574 filterUrl = #filterUrl old @ #filterUrl new, 584 filterUrl = #filterUrl old @ #filterUrl new,
575 filterMime = #filterMime old @ #filterMime new, 585 filterMime = #filterMime old @ #filterMime new,
586 filterRequest = #filterRequest old @ #filterRequest new,
587 filterResponse = #filterResponse old @ #filterResponse new,
576 sources = #sources new 588 sources = #sources new
577 @ List.filter (fn s => List.all (fn s' => s' <> s) (#sources new)) 589 @ List.filter (fn s => List.all (fn s' => s' <> s) (#sources new))
578 (#sources old), 590 (#sources old),
579 protocol = mergeO #2 (#protocol old, #protocol new), 591 protocol = mergeO #2 (#protocol old, #protocol new),
580 dbms = mergeO #2 (#dbms old, #dbms new), 592 dbms = mergeO #2 (#dbms old, #dbms new),
611 623
612 fun parseFkind s = 624 fun parseFkind s =
613 case s of 625 case s of
614 "url" => url 626 "url" => url
615 | "mime" => mime 627 | "mime" => mime
628 | "requestHeader" => request
629 | "responseHeader" => response
616 | _ => (ErrorMsg.error "Bad filter kind"; 630 | _ => (ErrorMsg.error "Bad filter kind";
617 url) 631 url)
618 632
619 fun parsePattern s = 633 fun parsePattern s =
620 if size s > 0 andalso String.sub (s, size s - 1) = #"*" then 634 if size s > 0 andalso String.sub (s, size s - 1) = #"*" then