comparison src/http/ngx_http_script.c @ 8786:d514f88053e5 quic

Merged with the default branch.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 28 May 2021 13:33:08 +0300
parents 3ab8e1e2f0f7
children d26db4f82d7d
comparison
equal deleted inserted replaced
8785:e6c26cb4d38b 8786:d514f88053e5
248 ngx_http_complex_value_t **cv; 248 ngx_http_complex_value_t **cv;
249 ngx_http_compile_complex_value_t ccv; 249 ngx_http_compile_complex_value_t ccv;
250 250
251 cv = (ngx_http_complex_value_t **) (p + cmd->offset); 251 cv = (ngx_http_complex_value_t **) (p + cmd->offset);
252 252
253 if (*cv != NULL) { 253 if (*cv != NGX_CONF_UNSET_PTR && *cv != NULL) {
254 return "is duplicate"; 254 return "is duplicate";
255 } 255 }
256 256
257 *cv = ngx_palloc(cf->pool, sizeof(ngx_http_complex_value_t)); 257 *cv = ngx_palloc(cf->pool, sizeof(ngx_http_complex_value_t));
258 if (*cv == NULL) { 258 if (*cv == NULL) {
264 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); 264 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
265 265
266 ccv.cf = cf; 266 ccv.cf = cf;
267 ccv.value = &value[1]; 267 ccv.value = &value[1];
268 ccv.complex_value = *cv; 268 ccv.complex_value = *cv;
269
270 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
271 return NGX_CONF_ERROR;
272 }
273
274 return NGX_CONF_OK;
275 }
276
277
278 char *
279 ngx_http_set_complex_value_zero_slot(ngx_conf_t *cf, ngx_command_t *cmd,
280 void *conf)
281 {
282 char *p = conf;
283
284 ngx_str_t *value;
285 ngx_http_complex_value_t **cv;
286 ngx_http_compile_complex_value_t ccv;
287
288 cv = (ngx_http_complex_value_t **) (p + cmd->offset);
289
290 if (*cv != NGX_CONF_UNSET_PTR) {
291 return "is duplicate";
292 }
293
294 *cv = ngx_palloc(cf->pool, sizeof(ngx_http_complex_value_t));
295 if (*cv == NULL) {
296 return NGX_CONF_ERROR;
297 }
298
299 value = cf->args->elts;
300
301 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
302
303 ccv.cf = cf;
304 ccv.value = &value[1];
305 ccv.complex_value = *cv;
306 ccv.zero = 1;
269 307
270 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { 308 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
271 return NGX_CONF_ERROR; 309 return NGX_CONF_ERROR;
272 } 310 }
273 311