-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathngx_http_set_hash_module.c
124 lines (106 loc) · 3.24 KB
/
ngx_http_set_hash_module.c
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
* Copyright (c) 2009 Marcus Clyne
*/
#include <ndk.h>
static ndk_set_var_t ngx_http_set_md5_hash = {
NDK_SET_VAR_HASH,
ndk_md5_hash,
MD5_DIGEST_LENGTH * 2,
NULL
};
static ndk_set_var_t ngx_http_set_md5_hash_upper = {
NDK_SET_VAR_HASH,
ndk_md5_hash_upper,
MD5_DIGEST_LENGTH * 2,
NULL
};
static ndk_set_var_t ngx_http_set_murmur2_hash = {
NDK_SET_VAR_HASH,
ndk_murmur2_hash,
MURMURHASH2_DIGEST_LENGTH * 2,
NULL
};
static ndk_set_var_t ngx_http_set_murmur2_hash_upper = {
NDK_SET_VAR_HASH,
ndk_murmur2_hash_upper,
MURMURHASH2_DIGEST_LENGTH * 2,
NULL
};
static ndk_set_var_t ngx_http_set_sha1_hash = {
NDK_SET_VAR_HASH,
ndk_sha1_hash,
SHA_DIGEST_LENGTH * 2,
NULL
};
static ndk_set_var_t ngx_http_set_sha1_hash_upper = {
NDK_SET_VAR_HASH,
ndk_sha1_hash_upper,
SHA_DIGEST_LENGTH * 2,
NULL
};
static ngx_command_t ngx_http_set_hash_commands[] = {
{
ngx_string ("set_md5"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE2,
ndk_set_var_value,
0,
0,
&ngx_http_set_md5_hash
},
{
ngx_string ("set_md5_upper"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE2,
ndk_set_var_value,
0,
0,
&ngx_http_set_md5_hash_upper
},
{
ngx_string ("set_murmur2"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE2,
ndk_set_var_value,
0,
0,
&ngx_http_set_murmur2_hash
},
{
ngx_string ("set_murmur2_upper"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE2,
ndk_set_var_value,
0,
0,
&ngx_http_set_murmur2_hash_upper
},
{
ngx_string ("set_sha1"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE2,
ndk_set_var_value,
0,
0,
&ngx_http_set_sha1_hash
},
{
ngx_string ("set_sha1_upper"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE2,
ndk_set_var_value,
0,
0,
&ngx_http_set_sha1_hash_upper
},
ngx_null_command
};
ngx_http_module_t ngx_http_set_hash_module_ctx = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
ngx_module_t ngx_http_set_hash_module = {
NGX_MODULE_V1,
&ngx_http_set_hash_module_ctx, // module context
ngx_http_set_hash_commands, // module directives
NGX_HTTP_MODULE, // module type
NULL, // init master
NULL, // init module
NULL, // init process
NULL, // init thread
NULL, // exit thread
NULL, // exit process
NULL, // exit master
NGX_MODULE_V1_PADDING
};