diff options
author | Paul Duncan <pabs@pablotron.org> | 2016-08-28 00:30:02 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2016-08-28 00:30:02 -0400 |
commit | 9315bbfd0f9e51da5438d29681cab6f9a6533d89 (patch) | |
tree | f02b70f56196e57be7086333b321e9cf012ac9ef /env.c | |
parent | 1bc717dc54b9964e7c62082b34d2d74e3daaa6a6 (diff) | |
download | libfhp-9315bbfd0f9e51da5438d29681cab6f9a6533d89.tar.bz2 libfhp-9315bbfd0f9e51da5438d29681cab6f9a6533d89.zip |
split up fhp.c
Diffstat (limited to 'env.c')
-rw-r--r-- | env.c | 44 |
1 files changed, 44 insertions, 0 deletions
@@ -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; +} |