From: Stefan Fritsch Date: Sat, 2 Jul 2011 07:32:26 +0000 (+0000) Subject: Add REQUEST_STATUS variable to ap_expr X-Git-Tag: 2.3.14^2~93 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0ddae368ab6e12da9316287731654847e737509d;p=apache Add REQUEST_STATUS variable to ap_expr git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1142163 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/expr.xml b/docs/manual/expr.xml index 4b4628cffa..07fbb667ac 100644 --- a/docs/manual/expr.xml +++ b/docs/manual/expr.xml @@ -226,6 +226,8 @@ listfunction ::= listfuncname "(" word ")" IPV6 "on" if the connection uses IPv6, "off" otherwise + REQUEST_STATUS + The HTTP error status of the request REQUEST_LOG_ID The error log id of the request (see ErrorLogFormat) diff --git a/server/util_expr_eval.c b/server/util_expr_eval.c index 3771caeb5e..64ab71c215 100644 --- a/server/util_expr_eval.c +++ b/server/util_expr_eval.c @@ -1080,6 +1080,7 @@ static const char *request_var_names[] = { "LAST_MODIFIED", /* 24 */ "CONTEXT_PREFIX", /* 25 */ "CONTEXT_DOCUMENT_ROOT", /* 26 */ + "REQUEST_STATUS", /* 27 */ NULL }; @@ -1163,6 +1164,8 @@ static const char *request_var_fn(ap_expr_eval_ctx_t *ctx, const void *data) return ap_context_prefix(r); case 26: return ap_context_document_root(r); + case 27: + return r->status ? apr_psprintf(ctx->p, "%d", r->status) : ""; default: ap_assert(0); return NULL;