summaryrefslogtreecommitdiff
path: root/env.c
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-08-28 00:30:02 -0400
committerPaul Duncan <pabs@pablotron.org>2016-08-28 00:30:02 -0400
commit9315bbfd0f9e51da5438d29681cab6f9a6533d89 (patch)
treef02b70f56196e57be7086333b321e9cf012ac9ef /env.c
parent1bc717dc54b9964e7c62082b34d2d74e3daaa6a6 (diff)
downloadlibfhp-9315bbfd0f9e51da5438d29681cab6f9a6533d89.tar.bz2
libfhp-9315bbfd0f9e51da5438d29681cab6f9a6533d89.zip
split up fhp.c
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;
+}