Merge r1726167 from trunk:
authorJim Jagielski <jim@apache.org>
Sat, 19 Mar 2016 13:25:28 +0000 (13:25 +0000)
committerJim Jagielski <jim@apache.org>
Sat, 19 Mar 2016 13:25:28 +0000 (13:25 +0000)
expr support for HTTP2 variable
Submitted by: icing
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1735769 13f79535-47bb-0310-9956-ffa450edef68

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

diff --git a/CHANGES b/CHANGES
index 8738a36097d084754566467ff2dd21b9faeba7bb..931dbb73c45e9bb73f155fb1ddf3369776ee36bc 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -15,6 +15,8 @@
   *) mod_reqtimeout: Prevent long response times from triggering a timeout once
      the request has been fully read.  PR 59045.  [Yann Ylavic]
 
+  *) ap_expr: expression support for variable HTTP2=on|off. [Stefan Eissing]
+     
   *) mod_http2: give control to async mpm for keepalive timeouts only when
      no streams are open and even if only after 1 sec delay. Under load, event
      mpm discards connections otherwise too quickly. [Stefan Eissing]
diff --git a/STATUS b/STATUS
index 24a195f6005333d881e073d26b6763bde152404e..532f43be1debd53cad1fb31a16e6fb0b5144dd07 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -112,11 +112,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) ap_expr: expression support for variable HTTP2=on|off
-     trunk patch: http://svn.apache.org/r1726167
-     2.4.x patch: https://eissing.org/expr_http2_2.4.patch
-     +1: icing, ylavic, trawick
-
   *) mod_ssl: Free dhparams when getting DH params. This fixes issue when
      SSLCryptoDevice does not get unregistered because of non-zero refcount
      during the mod_ssl unload happening on httpd startup.
index ca36fa2ef10d385dbb7dc4f2fabc12a63b66483c..577be3b524057bb24e72b72e380da1d9ed6a8b24 100644 (file)
@@ -254,6 +254,9 @@ listfunction ::= listfuncname "<strong>(</strong>" word "<strong>)</strong>"
     <tr><td><code>HANDLER</code></td>
         <td>The name of the <a href="handler.html">handler</a> creating
             the response</td></tr>
+    <tr><td><code>HTTP2</code></td>
+        <td>"<code>on</code>" if the request uses http/2,
+            "<code>off</code>" otherwise</td></tr>
     <tr><td><code>HTTPS</code></td>
         <td>"<code>on</code>" if the request uses https,
             "<code>off</code>" otherwise</td></tr>
index fbb3f6b94ce00c8cf05b9bb6e82a4c64ddd52989..86d11c7e7a75898b3b3019f41445cf3a739ba359 100644 (file)
@@ -1254,11 +1254,15 @@ static int op_file_subr(ap_expr_eval_ctx_t *ctx, const void *data, const char *a
 APR_DECLARE_OPTIONAL_FN(int, ssl_is_https, (conn_rec *));
 static APR_OPTIONAL_FN_TYPE(ssl_is_https) *is_https = NULL;
 
+APR_DECLARE_OPTIONAL_FN(int, http2_is_h2, (conn_rec *));
+static APR_OPTIONAL_FN_TYPE(http2_is_h2) *is_http2 = NULL;
+
 static const char *conn_var_names[] = {
     "HTTPS",                    /*  0 */
     "IPV6",                     /*  1 */
     "CONN_LOG_ID",              /*  2 */
     "CONN_REMOTE_ADDR",         /*  3 */
+    "HTTP2",                    /*  4 */
     NULL
 };
 
@@ -1292,6 +1296,11 @@ static const char *conn_var_fn(ap_expr_eval_ctx_t *ctx, const void *data)
         return c->log_id;
     case 3:
         return c->client_ip;
+    case 4:
+        if (is_http2 && is_http2(c))
+            return "on";
+        else
+            return "off";
     default:
         ap_assert(0);
         return NULL;
@@ -1782,6 +1791,7 @@ static int ap_expr_post_config(apr_pool_t *pconf, apr_pool_t *plog,
                                apr_pool_t *ptemp, server_rec *s)
 {
     is_https = APR_RETRIEVE_OPTIONAL_FN(ssl_is_https);
+    is_http2 = APR_RETRIEVE_OPTIONAL_FN(http2_is_h2);
     apr_pool_cleanup_register(pconf, &is_https, ap_pool_cleanup_set_null,
                               apr_pool_cleanup_null);
     return OK;