comparison src/http/ngx_http_script.h @ 7503:b82162b8496a

Added ngx_http_set_complex_value_size_slot(). If a complex value is expected to be of type size_t, and the compiled value is constant, the constant size_t value is remembered at compile time. The value is accessed through ngx_http_complex_value_size() which either returns the remembered constant or evaluates the expression and parses it as size_t.
author Ruslan Ermilov <ru@nginx.com>
date Wed, 24 Apr 2019 16:38:51 +0300
parents 5efc23d83bc2
children 3ab8e1e2f0f7
comparison
equal deleted inserted replaced
7502:b7a7c02aea3a 7503:b82162b8496a
66 typedef struct { 66 typedef struct {
67 ngx_str_t value; 67 ngx_str_t value;
68 ngx_uint_t *flushes; 68 ngx_uint_t *flushes;
69 void *lengths; 69 void *lengths;
70 void *values; 70 void *values;
71
72 union {
73 size_t size;
74 } u;
71 } ngx_http_complex_value_t; 75 } ngx_http_complex_value_t;
72 76
73 77
74 typedef struct { 78 typedef struct {
75 ngx_conf_t *cf; 79 ngx_conf_t *cf;
205 209
206 void ngx_http_script_flush_complex_value(ngx_http_request_t *r, 210 void ngx_http_script_flush_complex_value(ngx_http_request_t *r,
207 ngx_http_complex_value_t *val); 211 ngx_http_complex_value_t *val);
208 ngx_int_t ngx_http_complex_value(ngx_http_request_t *r, 212 ngx_int_t ngx_http_complex_value(ngx_http_request_t *r,
209 ngx_http_complex_value_t *val, ngx_str_t *value); 213 ngx_http_complex_value_t *val, ngx_str_t *value);
214 size_t ngx_http_complex_value_size(ngx_http_request_t *r,
215 ngx_http_complex_value_t *val, size_t default_value);
210 ngx_int_t ngx_http_compile_complex_value(ngx_http_compile_complex_value_t *ccv); 216 ngx_int_t ngx_http_compile_complex_value(ngx_http_compile_complex_value_t *ccv);
211 char *ngx_http_set_complex_value_slot(ngx_conf_t *cf, ngx_command_t *cmd, 217 char *ngx_http_set_complex_value_slot(ngx_conf_t *cf, ngx_command_t *cmd,
218 void *conf);
219 char *ngx_http_set_complex_value_size_slot(ngx_conf_t *cf, ngx_command_t *cmd,
212 void *conf); 220 void *conf);
213 221
214 222
215 ngx_int_t ngx_http_test_predicates(ngx_http_request_t *r, 223 ngx_int_t ngx_http_test_predicates(ngx_http_request_t *r,
216 ngx_array_t *predicates); 224 ngx_array_t *predicates);