# HG changeset patch # User Adam Chlipala # Date 1313758741 14400 # Node ID dc4c61363d0ac159d3cc137e067763b5b33ba025 # Parent 94ef0b07066aa5ac6c3de00d66374964f1f0f626 Add timestamps to 'app.js' filenames, to prevent inappropriate caching by browsers diff -r 94ef0b07066a -r dc4c61363d0a src/cjr_print.sml --- a/src/cjr_print.sml Mon Aug 15 12:33:28 2011 -0400 +++ b/src/cjr_print.sml Fri Aug 19 08:59:01 2011 -0400 @@ -2637,6 +2637,10 @@ newline] end + val timestamp = LargeInt.toString (Time.toMilliseconds (Time.now ())) + val app_js = OS.Path.joinDirFile {dir = Settings.getUrlPrefix (), + file = "app." ^ timestamp ^ ".js"} + fun p_page (ek, s, n, ts, ran, side, tellSig) = let val (ts, defInputs, inputsVar, fields) = @@ -2756,8 +2760,7 @@ let val scripts = "\\n" in foldl (fn (x, scripts) => @@ -3117,8 +3120,7 @@ string "static void uw_handle(uw_context ctx, char *request) {", newline, string "if (!strcmp(request, \"", - string (OS.Path.joinDirFile {dir = Settings.getUrlPrefix (), - file = "app.js"}), + string app_js, string "\")) {", newline, box [string "uw_Basis_string ims = uw_Basis_requestHeader(ctx, \"If-modified-since\");", diff -r 94ef0b07066a -r dc4c61363d0a tests/appjs.ur --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/appjs.ur Fri Aug 19 08:59:01 2011 -0400 @@ -0,0 +1,5 @@ +fun id n = if n = 0 then 0 else 1 + id (n - 1) + +fun main () : transaction page = return +