diff --git a/src/elogd.cxx b/src/elogd.cxx index d81d0667..e68a0a06 100755 --- a/src/elogd.cxx +++ b/src/elogd.cxx @@ -7423,9 +7423,16 @@ int scan_attributes(char *logbook) /*------------------------------------------------------------------*/ -void show_http_header(LOGBOOK *lbs, BOOL expires, const char *cookie) { +void show_http_header(LOGBOOK *lbs, BOOL expires, const char *cookie, int code) { char str[256]; + if (code == 401) + rsprintf("HTTP/1.1 401 Unauthorized\r\n"); + else if (code == 404) + rsprintf("HTTP/1.1 404 Not Found\r\n"); + else + rsprintf("HTTP/1.1 200 Document follows\r\n"); + rsprintf("HTTP/1.1 200 Document follows\r\n"); rsprintf("Server: ELOG HTTP %s-%s\r\n", VERSION, git_revision()); @@ -7469,13 +7476,13 @@ void show_plain_header(int size, const char *file_name) { rsprintf("\r\n"); } -void show_html_header(LOGBOOK *lbs, BOOL expires, const char *title, BOOL close_head, BOOL rss_feed, const char *cookie, - int embed_css, int refresh) { +void show_html_header(LOGBOOK *lbs, BOOL expires, const char *title, BOOL close_head, + BOOL rss_feed, const char *cookie, int embed_css, int refresh, int code) { int i, n; char css[1000], str[1000], media[1000], file_name[256]; char css_list[MAX_N_LIST][NAME_LENGTH]; - show_http_header(lbs, expires, cookie); + show_http_header(lbs, expires, cookie, code); /* DOCTYPE */ rsprintf("\n"); @@ -7583,7 +7590,7 @@ void show_browser(char *br) { void show_standard_header(LOGBOOK *lbs, BOOL expires, const char *title, const char *path, BOOL rss_feed, const char *cookie, const char *script, int refresh) { if (script) { - show_html_header(lbs, expires, title, FALSE, rss_feed, cookie, FALSE, refresh); + show_html_header(lbs, expires, title, FALSE, rss_feed, cookie, FALSE, refresh, 200); rsprintf("\n\n"); rsprintf("\n"); } else - show_html_header(lbs, expires, title, TRUE, rss_feed, cookie, FALSE, refresh); + show_html_header(lbs, expires, title, TRUE, rss_feed, cookie, FALSE, refresh, 200); if (script) rsprintf("
\n", script); @@ -7615,7 +7622,7 @@ void show_standard_header(LOGBOOK *lbs, BOOL expires, const char *title, const c void show_upgrade_page(LOGBOOK *lbs) { char str[1000]; - show_html_header(lbs, FALSE, "ELOG Upgrade Information", TRUE, FALSE, NULL, FALSE, 0); + show_html_header(lbs, FALSE, "ELOG Upgrade Information", TRUE, FALSE, NULL, FALSE, 0, 200); rsprintf("\n"); @@ -8416,10 +8423,10 @@ void send_file_direct(char *file_name) { close(fh); } else { char encodedname[256], str[256]; - show_html_header(NULL, FALSE, "404 Not Found", TRUE, FALSE, NULL, FALSE, 0); + show_html_header(NULL, FALSE, "404 Not Found", TRUE, FALSE, NULL, FALSE, 0, 404); - rsprintf("