comparison 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
comparison
equal deleted inserted replaced
862:66dbf3953758 863:305bc0a431de
2814 fun couldWrite ek = 2814 fun couldWrite ek =
2815 case ek of 2815 case ek of
2816 Link => false 2816 Link => false
2817 | Action ef => ef = ReadCookieWrite 2817 | Action ef => ef = ReadCookieWrite
2818 | Rpc ef => ef = ReadCookieWrite 2818 | Rpc ef => ef = ReadCookieWrite
2819
2820 val s =
2821 case Settings.getUrlPrefix () of
2822 "" => s
2823 | "/" => s
2824 | prefix =>
2825 if size s > 0 andalso String.sub (s, 0) = #"/" then
2826 prefix ^ String.extract (s, 1, NONE)
2827 else
2828 prefix ^ s
2819 in 2829 in
2820 box [string "if (!strncmp(request, \"", 2830 box [string "if (!strncmp(request, \"",
2821 string (String.toString s), 2831 string (String.toString s),
2822 string "\", ", 2832 string "\", ",
2823 string (Int.toString (size s)), 2833 string (Int.toString (size s)),
3272 file = "urweb.h"}), 3282 file = "urweb.h"}),
3273 string "\"", 3283 string "\"",
3274 newline, 3284 newline,
3275 newline, 3285 newline,
3276 3286
3287 string "const char *uw_url_prefix = \"",
3288 string (Settings.getUrlPrefix ()),
3289 string "\";",
3290 newline,
3291 newline,
3292
3277 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\\\">\";", 3293 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\\\">\";",
3278 newline, 3294 newline,
3279 newline, 3295 newline,
3280 3296
3281 p_list_sep newline (fn x => x) pds, 3297 p_list_sep newline (fn x => x) pds,
3322 newline, 3338 newline,
3323 newline, 3339 newline,
3324 3340
3325 string "void uw_handle(uw_context ctx, char *request) {", 3341 string "void uw_handle(uw_context ctx, char *request) {",
3326 newline, 3342 newline,
3327 string "if (!strcmp(request, \"/app.js\")) {", 3343 string "if (!strcmp(request, \"",
3344 string (OS.Path.joinDirFile {dir = Settings.getUrlPrefix (),
3345 file = "app.js"}),
3346 string "\")) {",
3328 newline, 3347 newline,
3329 box [string "uw_write_header(ctx, \"Content-type: text/javascript\\r\\n\");", 3348 box [string "uw_write_header(ctx, \"Content-type: text/javascript\\r\\n\");",
3330 newline, 3349 newline,
3331 string "uw_write(ctx, jslib);", 3350 string "uw_write(ctx, jslib);",
3332 newline, 3351 newline,