commit 59e5aed3ea2c36cc3a7713882b12372b4bb12754
parent 9f5ea876f9da3a2c270adcb48bc56d1f9ba603c4
Author: Francesco Saccone <francesco@francescosaccone.com>
Date: Tue, 1 Apr 2025 10:22:36 +0200
refactor: move mine_types from http.h to file.h
Signed-off-by: Francesco Saccone <francesco@francescosaccone.com>
Diffstat:
M | file.h | | | 25 | +++++++++++++++++++++++++ |
M | http.h | | | 25 | ------------------------- |
2 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/file.h b/file.h
@@ -3,6 +3,31 @@
#include <stdlib.h>
+static const struct {
+ const char *extension;
+ const char *type;
+} mime_types[] = {
+ { "css", "text/css" },
+ { "gif", "image/gif" },
+ { "gz", "application/gzip" },
+ { "html", "text/html" },
+ { "htm", "text/html" },
+ { "ico", "image/x-icon" },
+ { "jpeg", "image/jpeg" },
+ { "jpg", "image/jpeg" },
+ { "js", "application/javascript" },
+ { "json", "application/json" },
+ { "mp3", "audio/mpeg" },
+ { "mp4", "video/mp4" },
+ { "pdf", "application/pdf" },
+ { "png", "image/png" },
+ { "tar", "application/x-tar" },
+ { "txt", "text/plain" },
+ { "wav", "audio/wav" },
+ { "xml", "application/xml" },
+ { "zip", "application/zip" },
+};
+
struct file_content {
char *content;
size_t length;
diff --git a/http.h b/http.h
@@ -3,31 +3,6 @@
#define HTTP_REQUEST_PATH_MAX_LENGTH 256
-static const struct {
- const char *extension;
- const char *type;
-} mime_types[] = {
- { "css", "text/css" },
- { "gif", "image/gif" },
- { "gz", "application/gzip" },
- { "html", "text/html" },
- { "htm", "text/html" },
- { "ico", "image/x-icon" },
- { "jpeg", "image/jpeg" },
- { "jpg", "image/jpeg" },
- { "js", "application/javascript" },
- { "json", "application/json" },
- { "mp3", "audio/mpeg" },
- { "mp4", "video/mp4" },
- { "pdf", "application/pdf" },
- { "png", "image/png" },
- { "tar", "application/x-tar" },
- { "txt", "text/plain" },
- { "wav", "audio/wav" },
- { "xml", "application/xml" },
- { "zip", "application/zip" },
-};
-
enum http_request_method {
GET,
HEAD,