From: Jim Jagielski Date: Sat, 19 Mar 2016 13:25:28 +0000 (+0000) Subject: Merge r1726167 from trunk: X-Git-Tag: 2.4.19~40 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d97b9883c5a15ed8b3f37730537bb8f1960b6d36;p=apache Merge r1726167 from trunk: 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 --- diff --git a/CHANGES b/CHANGES index 8738a36097..931dbb73c4 100644 --- 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 24a195f600..532f43be1d 100644 --- 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. diff --git a/docs/manual/expr.xml b/docs/manual/expr.xml index ca36fa2ef1..577be3b524 100644 --- a/docs/manual/expr.xml +++ b/docs/manual/expr.xml @@ -254,6 +254,9 @@ listfunction ::= listfuncname "(" word ")" HANDLER The name of the handler creating the response + HTTP2 + "on" if the request uses http/2, + "off" otherwise HTTPS "on" if the request uses https, "off" otherwise diff --git a/server/util_expr_eval.c b/server/util_expr_eval.c index fbb3f6b94c..86d11c7e7a 100644 --- a/server/util_expr_eval.c +++ b/server/util_expr_eval.c @@ -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;