commit 3a5877e0522894112430811a6e0d30ce3c9943a8
parent 5247e939a7397be41149a5bad40ec98efbe957db
Author: Francesco Saccone <francesco@francescosaccone.com>
Date: Sun, 30 Mar 2025 18:50:37 +0200
feat: add mime_types
Signed-off-by: Francesco Saccone <francesco@francescosaccone.com>
Diffstat:
M | http.h | | | 25 | +++++++++++++++++++++++++ |
1 file changed, 25 insertions(+), 0 deletions(-)
diff --git a/http.h b/http.h
@@ -3,6 +3,31 @@
#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,