Mercurial > urweb
comparison src/cjr_print.sml @ 1542:dc4c61363d0a
Add timestamps to 'app.js' filenames, to prevent inappropriate caching by browsers
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Fri, 19 Aug 2011 08:59:01 -0400 |
parents | e627bab3eda7 |
children | 5f530f8e3511 |
comparison
equal
deleted
inserted
replaced
1541:94ef0b07066a | 1542:dc4c61363d0a |
---|---|
2635 unurlify true env t, | 2635 unurlify true env t, |
2636 string ";", | 2636 string ";", |
2637 newline] | 2637 newline] |
2638 end | 2638 end |
2639 | 2639 |
2640 val timestamp = LargeInt.toString (Time.toMilliseconds (Time.now ())) | |
2641 val app_js = OS.Path.joinDirFile {dir = Settings.getUrlPrefix (), | |
2642 file = "app." ^ timestamp ^ ".js"} | |
2643 | |
2640 fun p_page (ek, s, n, ts, ran, side, tellSig) = | 2644 fun p_page (ek, s, n, ts, ran, side, tellSig) = |
2641 let | 2645 let |
2642 val (ts, defInputs, inputsVar, fields) = | 2646 val (ts, defInputs, inputsVar, fields) = |
2643 case ek of | 2647 case ek of |
2644 Core.Action _ => | 2648 Core.Action _ => |
2754 ServerOnly => "" | 2758 ServerOnly => "" |
2755 | _ => | 2759 | _ => |
2756 let | 2760 let |
2757 val scripts = | 2761 val scripts = |
2758 "<script type=\\\"text/javascript\\\" src=\\\"" | 2762 "<script type=\\\"text/javascript\\\" src=\\\"" |
2759 ^ OS.Path.joinDirFile {dir = Settings.getUrlPrefix (), | 2763 ^ app_js |
2760 file = "app.js"} | |
2761 ^ "\\\"></script>\\n" | 2764 ^ "\\\"></script>\\n" |
2762 in | 2765 in |
2763 foldl (fn (x, scripts) => | 2766 foldl (fn (x, scripts) => |
2764 scripts | 2767 scripts |
2765 ^ "<script type=\\\"text/javascript\\\" src=\\\"" ^ x ^ "\\\"></script>\\n") | 2768 ^ "<script type=\\\"text/javascript\\\" src=\\\"" ^ x ^ "\\\"></script>\\n") |
3115 box (rev handlers), | 3118 box (rev handlers), |
3116 | 3119 |
3117 string "static void uw_handle(uw_context ctx, char *request) {", | 3120 string "static void uw_handle(uw_context ctx, char *request) {", |
3118 newline, | 3121 newline, |
3119 string "if (!strcmp(request, \"", | 3122 string "if (!strcmp(request, \"", |
3120 string (OS.Path.joinDirFile {dir = Settings.getUrlPrefix (), | 3123 string app_js, |
3121 file = "app.js"}), | |
3122 string "\")) {", | 3124 string "\")) {", |
3123 newline, | 3125 newline, |
3124 box [string "uw_Basis_string ims = uw_Basis_requestHeader(ctx, \"If-modified-since\");", | 3126 box [string "uw_Basis_string ims = uw_Basis_requestHeader(ctx, \"If-modified-since\");", |
3125 newline, | 3127 newline, |
3126 string ("if (ims && !strcmp(ims, \"" ^ Date.fmt rfcFmt nowD ^ "\")) {"), | 3128 string ("if (ims && !strcmp(ims, \"" ^ Date.fmt rfcFmt nowD ^ "\")) {"), |