Add REQUEST_STATUS variable to ap_expr
authorStefan Fritsch <sf@apache.org>
Sat, 2 Jul 2011 07:32:26 +0000 (07:32 +0000)
committerStefan Fritsch <sf@apache.org>
Sat, 2 Jul 2011 07:32:26 +0000 (07:32 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1142163 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/expr.xml
server/util_expr_eval.c

index 4b4628cffa2d26ef292992568ed34d33803849ab..07fbb667ac91f06096ce2faf0237707b6a1eba8d 100644 (file)
@@ -226,6 +226,8 @@ listfunction ::= listfuncname "<strong>(</strong>" word "<strong>)</strong>"
     <tr><td><code>IPV6</code></td>
         <td>"<code>on</code>" if the connection uses IPv6,
             "<code>off</code>" otherwise</td></tr>
+    <tr><td><code>REQUEST_STATUS</code></td>
+        <td>The HTTP error status of the request<td></tr>
     <tr><td><code>REQUEST_LOG_ID</code></td>
         <td>The error log id of the request (see
             <directive module="core">ErrorLogFormat</directive>)</td></tr>
index 3771caeb5e549eb91c4940713cc776ceb2f733b6..64ab71c215493740c9c483a9c7a1e60cf10478df 100644 (file)
@@ -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;