diff options
author | Adam Chlipala <adamc@hcoop.net> | 2010-01-02 13:31:59 -0500 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2010-01-02 13:31:59 -0500 |
commit | c8de04e4f81490bfde750375c55de2a260072e82 (patch) | |
tree | 8003213999cf3e6ad98db16c29cd135654599d1a /src | |
parent | 96ab8b7ac77b4b13e1aaa9afe35834ff60a6759b (diff) |
Proper 404 generation
Diffstat (limited to 'src')
-rw-r--r-- | src/c/urweb.c | 4 | ||||
-rw-r--r-- | src/cjr_print.sml | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c index e7495347..1bfb3cd5 100644 --- a/src/c/urweb.c +++ b/src/c/urweb.c @@ -1174,6 +1174,10 @@ void uw_write_header(uw_context ctx, uw_Basis_string s) { ctx->outHeaders.front += len; } +void uw_clear_headers(uw_context ctx) { + buf_reset(&ctx->outHeaders); +} + static void uw_check_script(uw_context ctx, size_t extra) { buf_check(&ctx->script, extra); } diff --git a/src/cjr_print.sml b/src/cjr_print.sml index 93f50de2..2cfd0663 100644 --- a/src/cjr_print.sml +++ b/src/cjr_print.sml @@ -2833,7 +2833,11 @@ fun p_file env (ds, ps) = newline, p_list_sep newline (fn x => x) pds', newline, - string "uw_error(ctx, FATAL, \"Unknown page\");", + string "uw_clear_headers(ctx);", + newline, + string "uw_write_header(ctx, \"HTTP/1.1 404 Not Found\\r\\nContent-type: text/plain\\r\\n\");", + newline, + string "uw_write(ctx, \"Not Found\");", newline, string "}", newline, |