Mercurial > hg > nginx
annotate src/http/ngx_http_script.h @ 9230:e14debe728b0 radix_with_skip
Closed the radix_with_skip branch.
The radix_with_skip branch is an archive of an experiment did in 2008,
and it is no longer relevant. It is now closed to avoid cluttering of
the branches list. If needed, closed branches still can be seen with
"hg branches --closed".
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sat, 23 Mar 2024 04:30:45 +0300 |
parents | 782af1038115 |
children | 912ce4113f21 |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
4 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
5 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
6 |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 #ifndef _NGX_HTTP_SCRIPT_H_INCLUDED_ |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #define _NGX_HTTP_SCRIPT_H_INCLUDED_ |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
479 | 11 #include <ngx_config.h> |
12 #include <ngx_core.h> | |
13 #include <ngx_http.h> | |
14 | |
15 | |
507 | 16 typedef struct { |
573 | 17 u_char *ip; |
18 u_char *pos; | |
19 ngx_http_variable_value_t *sp; | |
509 | 20 |
573 | 21 ngx_str_t buf; |
22 ngx_str_t line; | |
509 | 23 |
24 /* the start of the rewritten arguments */ | |
573 | 25 u_char *args; |
507 | 26 |
573 | 27 unsigned flushed:1; |
28 unsigned skip:1; | |
29 unsigned quote:1; | |
1891
782af1038115
length calculation did not take into account escaped symbols in arguments
Igor Sysoev <igor@sysoev.ru>
parents:
1565
diff
changeset
|
30 unsigned is_args:1; |
573 | 31 unsigned log:1; |
509 | 32 |
573 | 33 int *captures; |
34 ngx_uint_t ncaptures; | |
35 | |
36 ngx_int_t status; | |
37 ngx_http_request_t *request; | |
507 | 38 } ngx_http_script_engine_t; |
39 | |
40 | |
509 | 41 typedef struct { |
573 | 42 ngx_conf_t *cf; |
43 ngx_str_t *source; | |
509 | 44 |
573 | 45 ngx_array_t **flushes; |
46 ngx_array_t **lengths; | |
47 ngx_array_t **values; | |
509 | 48 |
573 | 49 ngx_uint_t variables; |
50 ngx_uint_t ncaptures; | |
641 | 51 ngx_uint_t captures_mask; |
573 | 52 ngx_uint_t size; |
53 | |
54 void *main; | |
507 | 55 |
573 | 56 unsigned compile_args:1; |
57 unsigned complete_lengths:1; | |
58 unsigned complete_values:1; | |
641 | 59 unsigned dup_capture:1; |
509 | 60 |
573 | 61 unsigned args:1; |
509 | 62 } ngx_http_script_compile_t; |
63 | |
64 | |
65 typedef void (*ngx_http_script_code_pt) (ngx_http_script_engine_t *e); | |
66 typedef size_t (*ngx_http_script_len_code_pt) (ngx_http_script_engine_t *e); | |
507 | 67 |
479 | 68 |
507 | 69 typedef struct { |
70 ngx_http_script_code_pt code; | |
71 uintptr_t len; | |
72 } ngx_http_script_copy_code_t; | |
73 | |
74 | |
75 typedef struct { | |
76 ngx_http_script_code_pt code; | |
77 uintptr_t index; | |
78 } ngx_http_script_var_code_t; | |
79 | |
80 | |
509 | 81 typedef struct { |
637 | 82 ngx_http_script_code_pt code; |
83 ngx_http_set_variable_pt handler; | |
84 uintptr_t data; | |
85 } ngx_http_script_var_handler_code_t; | |
86 | |
87 | |
88 typedef struct { | |
509 | 89 ngx_http_script_code_pt code; |
90 uintptr_t n; | |
91 } ngx_http_script_copy_capture_code_t; | |
92 | |
93 | |
517 | 94 #if (NGX_PCRE) |
95 | |
509 | 96 typedef struct { |
97 ngx_http_script_code_pt code; | |
98 ngx_regex_t *regex; | |
99 ngx_array_t *lengths; | |
100 uintptr_t size; | |
101 uintptr_t ncaptures; | |
102 uintptr_t status; | |
103 uintptr_t next; | |
104 | |
105 uintptr_t test:1; | |
631 | 106 uintptr_t negative_test:1; |
509 | 107 uintptr_t uri:1; |
108 uintptr_t args:1; | |
109 | |
110 /* add the r->args to the new arguments */ | |
111 uintptr_t add_args:1; | |
577 | 112 |
509 | 113 uintptr_t redirect:1; |
114 uintptr_t break_cycle:1; | |
115 | |
116 ngx_str_t name; | |
117 } ngx_http_script_regex_code_t; | |
118 | |
119 | |
120 typedef struct { | |
121 ngx_http_script_code_pt code; | |
122 | |
123 uintptr_t uri:1; | |
124 uintptr_t args:1; | |
125 | |
126 /* add the r->args to the new arguments */ | |
127 uintptr_t add_args:1; | |
128 | |
129 uintptr_t redirect:1; | |
130 } ngx_http_script_regex_end_code_t; | |
507 | 131 |
517 | 132 #endif |
133 | |
507 | 134 |
509 | 135 typedef struct { |
136 ngx_http_script_code_pt code; | |
137 uintptr_t status; | |
138 uintptr_t null; | |
139 } ngx_http_script_return_code_t; | |
140 | |
141 | |
631 | 142 typedef enum { |
143 ngx_http_script_file_plain = 0, | |
669 | 144 ngx_http_script_file_not_plain, |
145 ngx_http_script_file_dir, | |
146 ngx_http_script_file_not_dir, | |
147 ngx_http_script_file_exists, | |
148 ngx_http_script_file_not_exists, | |
149 ngx_http_script_file_exec, | |
150 ngx_http_script_file_not_exec | |
631 | 151 } ngx_http_script_file_op_e; |
152 | |
153 | |
154 typedef struct { | |
155 ngx_http_script_code_pt code; | |
156 uintptr_t op; | |
157 } ngx_http_script_file_code_t; | |
158 | |
159 | |
509 | 160 typedef struct { |
161 ngx_http_script_code_pt code; | |
162 uintptr_t next; | |
163 void **loc_conf; | |
164 } ngx_http_script_if_code_t; | |
165 | |
166 | |
167 typedef struct { | |
168 ngx_http_script_code_pt code; | |
515 | 169 ngx_array_t *lengths; |
170 } ngx_http_script_complex_value_code_t; | |
171 | |
172 | |
173 typedef struct { | |
174 ngx_http_script_code_pt code; | |
509 | 175 uintptr_t value; |
176 uintptr_t text_len; | |
177 uintptr_t text_data; | |
178 } ngx_http_script_value_code_t; | |
179 | |
507 | 180 |
509 | 181 ngx_uint_t ngx_http_script_variables_count(ngx_str_t *value); |
182 ngx_int_t ngx_http_script_compile(ngx_http_script_compile_t *sc); | |
623 | 183 u_char *ngx_http_script_run(ngx_http_request_t *r, ngx_str_t *value, |
184 void *code_lengths, size_t reserved, void *code_values); | |
1565 | 185 void ngx_http_script_flush_no_cacheable_variables(ngx_http_request_t *r, |
573 | 186 ngx_array_t *indices); |
509 | 187 |
188 void *ngx_http_script_start_code(ngx_pool_t *pool, ngx_array_t **codes, | |
189 size_t size); | |
190 void *ngx_http_script_add_code(ngx_array_t *codes, size_t size, void *code); | |
507 | 191 |
509 | 192 size_t ngx_http_script_copy_len_code(ngx_http_script_engine_t *e); |
193 void ngx_http_script_copy_code(ngx_http_script_engine_t *e); | |
194 size_t ngx_http_script_copy_var_len_code(ngx_http_script_engine_t *e); | |
195 void ngx_http_script_copy_var_code(ngx_http_script_engine_t *e); | |
196 size_t ngx_http_script_copy_capture_len_code(ngx_http_script_engine_t *e); | |
197 void ngx_http_script_copy_capture_code(ngx_http_script_engine_t *e); | |
1891
782af1038115
length calculation did not take into account escaped symbols in arguments
Igor Sysoev <igor@sysoev.ru>
parents:
1565
diff
changeset
|
198 size_t ngx_http_script_mark_args_code(ngx_http_script_engine_t *e); |
517 | 199 void ngx_http_script_start_args_code(ngx_http_script_engine_t *e); |
200 #if (NGX_PCRE) | |
509 | 201 void ngx_http_script_regex_start_code(ngx_http_script_engine_t *e); |
202 void ngx_http_script_regex_end_code(ngx_http_script_engine_t *e); | |
517 | 203 #endif |
509 | 204 void ngx_http_script_return_code(ngx_http_script_engine_t *e); |
527 | 205 void ngx_http_script_break_code(ngx_http_script_engine_t *e); |
509 | 206 void ngx_http_script_if_code(ngx_http_script_engine_t *e); |
577 | 207 void ngx_http_script_equal_code(ngx_http_script_engine_t *e); |
208 void ngx_http_script_not_equal_code(ngx_http_script_engine_t *e); | |
631 | 209 void ngx_http_script_file_code(ngx_http_script_engine_t *e); |
515 | 210 void ngx_http_script_complex_value_code(ngx_http_script_engine_t *e); |
509 | 211 void ngx_http_script_value_code(ngx_http_script_engine_t *e); |
212 void ngx_http_script_set_var_code(ngx_http_script_engine_t *e); | |
637 | 213 void ngx_http_script_var_set_handler_code(ngx_http_script_engine_t *e); |
509 | 214 void ngx_http_script_var_code(ngx_http_script_engine_t *e); |
215 void ngx_http_script_nop_code(ngx_http_script_engine_t *e); | |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
216 |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
217 |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
218 #endif /* _NGX_HTTP_SCRIPT_H_INCLUDED_ */ |