forked from 100Continue/Themis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathngx_http_themis_interface.c
63 lines (45 loc) · 1.17 KB
/
ngx_http_themis_interface.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
#include <ngx_themis.h>
ngx_array_t *
ngx_http_themis_parse_uri(ngx_http_request_t *r)
{
u_char *p, *last, *end;
ngx_str_t *str;
ngx_array_t *array;
array = ngx_array_create(r->pool, 8, sizeof(ngx_str_t));
if (array == NULL) {
return NULL;
}
p = r->uri.data + 1;
last = r->uri.data + r->uri.len;
end = p;
while(p < last) {
end = ngx_strlchr(p, last, '/');
str = ngx_array_push(array);
if (str == NULL) {
return NULL;
}
if (end) {
str->data = p;
str->len = end - p;
} else {
str->data = p;
str->len = last - p;
}
p += str->len + 1;
}
return array;
}
ngx_int_t
ngx_http_themis_module_parse_cmd(ngx_http_request_t *r, ngx_array_t *parms)
{
ngx_str_t name, module, cmd, *value;
value = parms->elts;
name = value[0];
module = value[1];
cmd = value[2];
ngx_log_themis_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"name: %V, module: %V, cmoomad: %V",
&name, &module, &cmd);
/* TODO */
return NGX_OK;
}