summaryrefslogtreecommitdiff
path: root/env.c
diff options
context:
space:
mode:
Diffstat (limited to 'env.c')
-rw-r--r--env.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/env.c b/env.c
new file mode 100644
index 0000000..721d392
--- /dev/null
+++ b/env.c
@@ -0,0 +1,44 @@
+#include <string.h>
+#include "fhp/fhp.h"
+
+static char * const
+fhp_strings[] = {
+ "GET",
+ "POST",
+ "HEAD",
+ "PUT",
+ "DELETE",
+ "OPTIONS",
+ "HTTP/1.0",
+ "HTTP/1.1",
+ "content-length",
+ "transfer-encoding",
+ "gzip",
+ "x-gzip",
+ "deflate",
+ "x-deflate",
+ "compress",
+ "x-compress",
+ "chunked",
+ NULL
+};
+
+void
+fhp_env_init(fhp_env_t * const env) {
+ for (size_t i = 0; fhp_strings[i]; i++)
+ env->hashes[i] = fhp_lc_hash_string(fhp_strings[i]);
+}
+
+static fhp_env_t fhp_default_env;
+
+fhp_env_t *
+fhp_get_default_env(void) {
+ static fhp_env_t *r = NULL;
+
+ if (!r) {
+ r = &fhp_default_env;
+ fhp_env_init(r);
+ }
+
+ return r;
+}