From 5a39c5bb118379c49c574f25364a439fb13a8624 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Wed, 25 Mar 2009 08:37:09 +0000 Subject: [PATCH] Return 404 in case of error SVN revision: 2184 --- src/elogd.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/elogd.c b/src/elogd.c index c49f7f8b..3d299149 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -7940,8 +7940,23 @@ void show_bottom_text_login(LOGBOOK * lbs) void show_error(char *error) { + char str[256]; + /* header */ - show_html_header(NULL, FALSE, "ELOG error", TRUE, FALSE, NULL, FALSE); + rsprintf("HTTP/1.1 404 Not Found\r\n"); + rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision + 13)); + if (getcfg("global", "charset", str, sizeof(str))) + rsprintf("Content-Type: text/html;charset=%s\r\n", str); + else + rsprintf("Content-Type: text/html;charset=%s\r\n", DEFAULT_HTTP_CHARSET); + rsprintf("\r\n"); + + rsprintf("\n"); + rsprintf("\n"); + rsprintf("\n"); + rsprintf("%s\n", loc("ELOG error")); + rsprintf("\n"); + rsprintf("\n"); rsprintf("
\n"); rsprintf("\n
"); - /* - rsprintf("\n"); - - rsprintf("\n"); rsprintf("
\n"); rsprintf("
\n"); @@ -9393,9 +9402,9 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL /* check for author */ if (bedit && getcfg(lbs->name, "Restrict edit", str, sizeof(str)) && atoi(str) == 1) { if (!is_author(lbs, attrib, owner)) { - sprintf(str, loc("Only user %s can edit this entry"), owner); - strencode2(str2, str, sizeof(str2)); - show_error(str2); + strencode2(str2, owner, sizeof(str2)); + sprintf(str, loc("Only user %s can edit this entry"), str2); + show_error(str); xfree(text); return; }