Skip to content

Commit

Permalink
Better 404
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesper André Lyngesen Pedersen committed Feb 10, 2010
1 parent 97e4a49 commit 476e05e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/http/request_processor.c
Expand Up @@ -156,9 +156,12 @@ static int http_send_file(http_parser *parser) {
conn_info->path, conn_info->path_size);
fd = fopen(file, "r");
if (fd == NULL) {
const char *err = "<html><head><title>Error</title></head><body>%s</body></html>";
const char *err_404 = "<pre>File not found</pre>";
log_debug("404 %s", file);
send_header(conn_info->client_fd, 404, "NOT FOUND",
get_mimetype(file, conn_info->conf));
"text/html");
fprintf(conn_info->client_fd, err, err_404);
} else {
log_debug("Getting: %s", file);
send_header(conn_info->client_fd, 200, "OK",
Expand Down

0 comments on commit 476e05e

Please sign in to comment.