comparison src/http/ngx_http_variables.h @ 3325:42c16d8bddbe

regex named captures
author Igor Sysoev <igor@sysoev.ru>
date Mon, 16 Nov 2009 12:19:02 +0000
parents f267d23868fc
children fe08c14530e9
comparison
equal deleted inserted replaced
3324:616da2ea901f 3325:42c16d8bddbe
39 ngx_uint_t flags; 39 ngx_uint_t flags;
40 ngx_uint_t index; 40 ngx_uint_t index;
41 }; 41 };
42 42
43 43
44 typedef struct {
45 ngx_uint_t capture;
46 ngx_int_t index;
47 } ngx_http_regex_variable_t;
48
49
50 typedef struct {
51 ngx_regex_t *regex;
52 ngx_uint_t ncaptures;
53 ngx_http_regex_variable_t *variables;
54 ngx_uint_t nvariables;
55 ngx_str_t name;
56 } ngx_http_regex_t;
57
58
44 ngx_http_variable_t *ngx_http_add_variable(ngx_conf_t *cf, ngx_str_t *name, 59 ngx_http_variable_t *ngx_http_add_variable(ngx_conf_t *cf, ngx_str_t *name,
45 ngx_uint_t flags); 60 ngx_uint_t flags);
46 ngx_int_t ngx_http_get_variable_index(ngx_conf_t *cf, ngx_str_t *name); 61 ngx_int_t ngx_http_get_variable_index(ngx_conf_t *cf, ngx_str_t *name);
47 ngx_http_variable_value_t *ngx_http_get_indexed_variable(ngx_http_request_t *r, 62 ngx_http_variable_value_t *ngx_http_get_indexed_variable(ngx_http_request_t *r,
48 ngx_uint_t index); 63 ngx_uint_t index);
55 ngx_int_t ngx_http_variable_unknown_header(ngx_http_variable_value_t *v, 70 ngx_int_t ngx_http_variable_unknown_header(ngx_http_variable_value_t *v,
56 ngx_str_t *var, ngx_list_part_t *part, size_t prefix); 71 ngx_str_t *var, ngx_list_part_t *part, size_t prefix);
57 72
58 73
59 #define ngx_http_clear_variable(r, index) r->variables0[index].text.data = NULL; 74 #define ngx_http_clear_variable(r, index) r->variables0[index].text.data = NULL;
75
76
77 ngx_http_regex_t *ngx_http_regex_compile(ngx_conf_t *cf,
78 ngx_regex_compile_t *rc);
79 ngx_int_t ngx_http_regex_exec(ngx_http_request_t *r, ngx_http_regex_t *re,
80 ngx_str_t *s);
60 81
61 82
62 ngx_int_t ngx_http_variables_add_core_vars(ngx_conf_t *cf); 83 ngx_int_t ngx_http_variables_add_core_vars(ngx_conf_t *cf);
63 ngx_int_t ngx_http_variables_init_vars(ngx_conf_t *cf); 84 ngx_int_t ngx_http_variables_init_vars(ngx_conf_t *cf);
64 85