MCPcopy Create free account
hub / github.com/apache/httpd / ap_expr_str_exec_re

Function ap_expr_str_exec_re

server/util_expr_eval.c:913–967  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

911}
912
913AP_DECLARE(const char *) ap_expr_str_exec_re(request_rec *r,
914 const ap_expr_info_t *info,
915 apr_size_t nmatch,
916 ap_regmatch_t *pmatch,
917 const char **source,
918 const char **err)
919{
920 ap_expr_eval_ctx_t ctx;
921 int dont_vary, rc;
922 const char *tmp_source, *vary_this;
923 ap_regmatch_t tmp_pmatch[AP_MAX_REG_MATCH];
924 const char *result;
925
926 AP_DEBUG_ASSERT(info->flags & AP_EXPR_FLAG_STRING_RESULT);
927
928 if (info->root_node->node_op == op_String) {
929 /* short-cut for constant strings */
930 *err = NULL;
931 return (const char *)info->root_node->node_arg1;
932 }
933
934 tmp_source = NULL;
935 vary_this = NULL;
936
937 dont_vary = (info->flags & AP_EXPR_FLAG_DONT_VARY);
938
939 ctx.r = r;
940 ctx.c = r->connection;
941 ctx.s = r->server;
942 ctx.p = r->pool;
943 ctx.err = err;
944 ctx.info = info;
945 ctx.re_nmatch = nmatch;
946 ctx.re_pmatch = pmatch;
947 ctx.re_source = source;
948 ctx.vary_this = dont_vary ? NULL : &vary_this;
949 ctx.data = NULL;
950 ctx.result_string = &result;
951
952 if (!pmatch) {
953 ctx.re_nmatch = AP_MAX_REG_MATCH;
954 ctx.re_pmatch = tmp_pmatch;
955 ctx.re_source = &tmp_source;
956 }
957
958 rc = ap_expr_exec_ctx(&ctx);
959 if (rc > 0)
960 return result;
961 else if (rc < 0)
962 return NULL;
963 else
964 ap_assert(0);
965 /* Not reached */
966 return NULL;
967}
968
969AP_DECLARE(const char *) ap_expr_str_exec(request_rec *r,
970 const ap_expr_info_t *info,

Callers 2

fix_cgivarsFunction · 0.85
ap_expr_str_execFunction · 0.85

Calls 1

ap_expr_exec_ctxFunction · 0.85

Tested by

no test coverage detected