1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#include "internal.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;
}
|