2
0
Fork 0

add mimetype info to static action

This commit is contained in:
Thomas Porzelt 2008-10-03 01:50:47 +02:00
parent 24f4a86576
commit 20956e757e
1 changed files with 5 additions and 0 deletions

View File

@ -156,7 +156,12 @@ static action_result core_handle_static(connection *con, gpointer param) {
con->response.http_status = 404;
close(fd);
} else {
GString *mime_str = mimetype_get(con, con->request.uri.path);
con->response.http_status = 200;
if (mime_str)
http_header_overwrite(con->response.headers, CONST_STR_LEN("Content-Type"), GSTR_LEN(mime_str));
else
http_header_overwrite(con->response.headers, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("application/octet-stream"));
chunkqueue_append_file_fd(con->out, NULL, 0, st.st_size, fd);
}
}