From 2ace7fc3e683fcfa44ff9c355face60983db7eae Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Wed, 24 Apr 2019 16:38:51 +0300 Subject: 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. --- src/stream/ngx_stream_script.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/stream/ngx_stream_script.h') diff --git a/src/stream/ngx_stream_script.h b/src/stream/ngx_stream_script.h index 25a450d2a..a481ca3ab 100644 --- a/src/stream/ngx_stream_script.h +++ b/src/stream/ngx_stream_script.h @@ -56,6 +56,10 @@ typedef struct { ngx_uint_t *flushes; void *lengths; void *values; + + union { + size_t size; + } u; } ngx_stream_complex_value_t; @@ -102,10 +106,14 @@ void ngx_stream_script_flush_complex_value(ngx_stream_session_t *s, ngx_stream_complex_value_t *val); ngx_int_t ngx_stream_complex_value(ngx_stream_session_t *s, ngx_stream_complex_value_t *val, ngx_str_t *value); +size_t ngx_stream_complex_value_size(ngx_stream_session_t *s, + ngx_stream_complex_value_t *val, size_t default_value); ngx_int_t ngx_stream_compile_complex_value( ngx_stream_compile_complex_value_t *ccv); char *ngx_stream_set_complex_value_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +char *ngx_stream_set_complex_value_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); ngx_uint_t ngx_stream_script_variables_count(ngx_str_t *value); -- cgit