Lines Matching refs:dc
37 const data_config * const dc = (data_config *)config_reference.data[idx]; in config_get_config_cond_info() local
38 cfginfo->comp = dc->comp; in config_get_config_cond_info()
39 cfginfo->cond = dc->cond; in config_get_config_cond_info()
40 cfginfo->string = &dc->string; in config_get_config_cond_info()
41 cfginfo->comp_key = dc->comp_key; in config_get_config_cond_info()
45 data_config * const dc = (data_config *)config_reference.data[idx]; in config_capture() local
46 return (dc->capture_idx) in config_capture()
47 ? dc->capture_idx in config_capture()
48 : (dc->capture_idx = ++srv->config_captures); in config_capture()
310 const data_config * const dc = in config_plugin_values_init() local
312 const array * const ca = dc->value; in config_plugin_values_init()
332 && (dc->comp!=COMP_SERVER_SOCKET || dc->cond!=CONFIG_COND_EQ)) in config_plugin_values_init()
374 static void config_cond_result_trace(request_st * const r, const data_config * const dc, const int … in config_cond_result_trace() argument
375 cond_cache_t * const cache = &r->cond_cache[dc->context_ndx]; in config_cond_result_trace()
385 dc->context_ndx, &"uncached"[cached ? 2 : 0], msg, dc->key.ptr); in config_cond_result_trace()
388 static cond_result_t config_check_cond_nocache(request_st *r, const data_config *dc, int debug_cond…
390 …ig_check_cond_nocache_calc(request_st * const r, const data_config * const dc, const int debug_con… in config_check_cond_nocache_calc() argument
391 cache->result = config_check_cond_nocache(r, dc, debug_cond, cache); in config_check_cond_nocache_calc()
392 if (debug_cond) config_cond_result_trace(r, dc, 0); in config_check_cond_nocache_calc()
396 static cond_result_t config_check_cond_cached(request_st * const r, const data_config * const dc, c… in config_check_cond_cached() argument
397 cond_cache_t * const cache = &r->cond_cache[dc->context_ndx]; in config_check_cond_cached()
399 if (debug_cond) config_cond_result_trace(r, dc, 1); in config_check_cond_cached()
402 return config_check_cond_nocache_calc(r, dc, debug_cond, cache); in config_check_cond_cached()
405 static int config_pcre_match(request_st *r, const data_config *dc, const buffer *b);
407 …ig_check_cond_nocache_eval(request_st * const r, const data_config * const dc, const int debug_con…
409 static cond_result_t config_check_cond_nocache(request_st * const r, const data_config * const dc, … in config_check_cond_nocache() argument
411 if (dc->parent && dc->parent->context_ndx) { in config_check_cond_nocache()
418 log_error(r->conf.errh, __FILE__, __LINE__, "go parent %s", dc->parent->key.ptr); in config_check_cond_nocache()
421 switch (config_check_cond_cached(r, dc->parent, debug_cond)) { in config_check_cond_nocache()
435 if (dc->prev) { in config_check_cond_nocache()
441 log_error(r->conf.errh, __FILE__, __LINE__, "go prev %s", dc->prev->key.ptr); in config_check_cond_nocache()
445 switch (config_check_cond_cached(r, dc->prev, debug_cond)) { in config_check_cond_nocache()
459 if (!(r->conditional_is_valid & (1 << dc->comp))) { in config_check_cond_nocache()
462 "%d %s not available yet", dc->comp, dc->key.ptr); in config_check_cond_nocache()
477 if (CONFIG_COND_ELSE == dc->cond) in config_check_cond_nocache()
481 return config_check_cond_nocache_eval(r, dc, debug_cond, cache); in config_check_cond_nocache()
484 …ig_check_cond_nocache_eval(request_st * const r, const data_config * const dc, const int debug_con… in config_check_cond_nocache_eval() argument
494 switch (dc->comp) { in config_check_cond_nocache_eval()
514 l = http_header_request_get(r, dc->ext, BUF_PTR_LEN(&dc->comp_tag)); in config_check_cond_nocache_eval()
528 "%s compare to %s", dc->comp_key, l->ptr); in config_check_cond_nocache_eval()
531 switch(dc->cond) { in config_check_cond_nocache_eval()
534 match = (dc->cond == CONFIG_COND_EQ); in config_check_cond_nocache_eval()
535 if (dc->comp == COMP_HTTP_HOST && dc->string.ptr[0] != '/') { in config_check_cond_nocache_eval()
537 uint_fast32_t dlen = buffer_clen(&dc->string); in config_check_cond_nocache_eval()
546 : dc->string.ptr[(dlen = llen)] == ':') in config_check_cond_nocache_eval()
547 && 0 == memcmp(l->ptr, dc->string.ptr, dlen); in config_check_cond_nocache_eval()
551 else if (dc->comp == COMP_HTTP_REMOTE_IP && dc->string.ptr[0] != '/') { in config_check_cond_nocache_eval()
556 (((uintptr_t)dc->string.ptr + dc->string.used + 1 + 7) & ~7); in config_check_cond_nocache_eval()
557 int bits = ((unsigned char *)dc->string.ptr)[dc->string.used]; in config_check_cond_nocache_eval()
563 match ^= (buffer_is_equal(l, &dc->string)); in config_check_cond_nocache_eval()
567 match = (dc->cond == CONFIG_COND_MATCH); in config_check_cond_nocache_eval()
568 match ^= (config_pcre_match(r, dc, l) > 0); in config_check_cond_nocache_eval()
574 uint_fast32_t dlen = buffer_clen(&dc->string); in config_check_cond_nocache_eval()
575 uint_fast32_t off = (dc->cond == CONFIG_COND_PREFIX) in config_check_cond_nocache_eval()
579 && 0 == memcmp(l->ptr+off, dc->string.ptr, dlen)); in config_check_cond_nocache_eval()
593 const data_config * const dc = config_reference.data[context_ndx]; in config_check_cond_calc() local
599 return config_check_cond_nocache_calc(r, dc, debug_cond, cache); in config_check_cond_calc()
613 static void config_cond_clear_node(cond_cache_t * const cond_cache, const data_config * const dc) { in config_cond_clear_node() argument
615 if (cond_cache[dc->context_ndx].result != COND_RESULT_UNSET) { in config_cond_clear_node()
616 cond_cache[dc->context_ndx].result = COND_RESULT_UNSET; in config_cond_clear_node()
618 for (uint32_t i = 0; i < dc->children.used; ++i) { in config_cond_clear_node()
619 const data_config *dc_child = dc->children.data[i]; in config_cond_clear_node()
625 if (NULL != dc->next) config_cond_clear_node(cond_cache, dc->next); in config_cond_clear_node()
637 const data_config * const dc = data[i]; in config_cond_cache_reset_item() local
639 if (item == dc->comp) { in config_cond_cache_reset_item()
643 config_cond_clear_node(cond_cache, dc); in config_cond_cache_reset_item()
666 static int config_pcre_match(request_st * const r, const data_config * const dc, const buffer * con… in config_pcre_match() argument
670 if (__builtin_expect( (0 == dc->capture_idx), 1)) in config_pcre_match()
671 return pcre2_match(dc->code, (PCRE2_SPTR)BUF_PTR_LEN(b), in config_pcre_match()
672 0, 0, dc->match_data, NULL); in config_pcre_match()
674 const int capture_offset = dc->capture_idx - 1; in config_pcre_match()
687 match_data = cond_match->match_data = (0 == dc->capture_idx) in config_pcre_match()
689 : pcre2_match_data_create_from_pattern(dc->code, NULL); in config_pcre_match()
692 pcre2_match_data_create_from_pattern(dc->code, NULL); in config_pcre_match()
699 pcre2_match(dc->code, (PCRE2_SPTR)BUF_PTR_LEN(b), 0, 0, match_data, NULL); in config_pcre_match()
704 if (__builtin_expect( (0 == dc->capture_idx), 1)) { in config_pcre_match()
706 return pcre_exec(dc->regex, dc->regex_study, BUF_PTR_LEN(b), 0, 0, in config_pcre_match()
710 const int capture_offset = dc->capture_idx - 1; in config_pcre_match()
715 cond_match->matches = ck_malloc(dc->ovec_nelts * sizeof(int)); in config_pcre_match()
719 pcre_exec(dc->regex, dc->regex_study, BUF_PTR_LEN(b), 0, 0, in config_pcre_match()
720 cond_match->matches, dc->ovec_nelts); in config_pcre_match()
726 UNUSED(dc); in config_pcre_match()