ref: 7dd317b68c520d542a3b04a3f55aeca8a3bbbf8b
parent: ef1c264e16ca17cd69e24104fcce09410c00b8b8
author: kvik <[email protected]>
date: Sun Aug 2 11:17:35 EDT 2020
Add support for additional content types
--- a/tcp80.c
+++ b/tcp80.c
@@ -4,6 +4,8 @@
#include <auth.h>
typedef struct Pair Pair;
+typedef struct Ctype Ctype;
+
struct Pair
{
Pair *next;
@@ -13,6 +15,12 @@
char *att;
};
+struct Ctype
+{
+ char *suffix;
+ char *type;
+};
+
int trusted;
char remote[128];
@@ -23,6 +31,12 @@
int naheader;
Pair aheader[64];
+Ctype ctypemap[] = {
+ ".htm", "text/html;charset=utf-8",
+ ".html", "text/html;charset=utf-8",
+ ".txt", "text/plain;charset=utf-8",
+ ".md", "text/markdown;charset=utf-8",
+};
Pair*
findhdr(Pair *h, char *key)