diff src/cjr_print.sml @ 863:305bc0a431de

.msgs processing in FastCGI
author Adam Chlipala <adamc@hcoop.net>
date Sat, 27 Jun 2009 17:50:31 -0400
parents 346cf1908a17
children 03e7f111fe99
line wrap: on
line diff
--- a/src/cjr_print.sml	Sat Jun 27 16:56:32 2009 -0400
+++ b/src/cjr_print.sml	Sat Jun 27 17:50:31 2009 -0400
@@ -2816,6 +2816,16 @@
                         Link => false
                       | Action ef => ef = ReadCookieWrite
                       | Rpc ef => ef = ReadCookieWrite
+
+                val s =
+                    case Settings.getUrlPrefix () of
+                        "" => s
+                      | "/" => s
+                      | prefix =>
+                        if size s > 0 andalso String.sub (s, 0) = #"/" then
+                            prefix ^ String.extract (s, 1, NONE)
+                        else
+                            prefix ^ s
             in
                 box [string "if (!strncmp(request, \"",
                      string (String.toString s),
@@ -3274,6 +3284,12 @@
              newline,
              newline,
 
+             string "const char *uw_url_prefix = \"",
+             string (Settings.getUrlPrefix ()),
+             string "\";",
+             newline,
+             newline,
+
              string "static const char begin_xhtml[] = \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\" ?>\\n<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Transitional//EN\\\" \\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\\">\\n<html xmlns=\\\"http://www.w3.org/1999/xhtml\\\" xml:lang=\\\"en\\\" lang=\\\"en\\\">\";",
              newline,
              newline,
@@ -3324,7 +3340,10 @@
 
              string "void uw_handle(uw_context ctx, char *request) {",
              newline,
-             string "if (!strcmp(request, \"/app.js\")) {",
+             string "if (!strcmp(request, \"",
+             string (OS.Path.joinDirFile {dir = Settings.getUrlPrefix (),
+                                          file = "app.js"}),
+             string "\")) {",
              newline,
              box [string "uw_write_header(ctx, \"Content-type: text/javascript\\r\\n\");",
                   newline,