Return-Path: X-Original-To: apmail-httpd-dev-archive@www.apache.org Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AF3CA187BA for ; Wed, 20 Jan 2016 16:31:25 +0000 (UTC) Received: (qmail 32110 invoked by uid 500); 20 Jan 2016 16:31:25 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 32021 invoked by uid 500); 20 Jan 2016 16:31:25 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 32010 invoked by uid 99); 20 Jan 2016 16:31:25 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jan 2016 16:31:25 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id A648AC38BB for ; Wed, 20 Jan 2016 16:31:24 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.653 X-Spam-Level: X-Spam-Status: No, score=0.653 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, SPF_NEUTRAL=0.652, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=comcast.net Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id iKZbCVDhhhUK for ; Wed, 20 Jan 2016 16:31:15 +0000 (UTC) Received: from resqmta-po-05v.sys.comcast.net (resqmta-po-05v.sys.comcast.net [96.114.154.164]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 29E43215D6 for ; Wed, 20 Jan 2016 16:31:13 +0000 (UTC) Received: from resomta-po-13v.sys.comcast.net ([96.114.154.237]) by resqmta-po-05v.sys.comcast.net with comcast id 8GW41s00857bBgG01GXCQj; Wed, 20 Jan 2016 16:31:12 +0000 Received: from [192.168.199.10] ([69.251.84.114]) by resomta-po-13v.sys.comcast.net with comcast id 8GXB1s0092U0RYt01GXBfL; Wed, 20 Jan 2016 16:31:12 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Subject: Re: Work in progress: mod_proxy Health Check module From: Jim Jagielski In-Reply-To: <569FB1A8.9080208@kippdata.de> Date: Wed, 20 Jan 2016 11:31:11 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <2E486C0B-230B-48D2-8A91-07FF37E876DC@jaguNET.com> References: <25B13108-E732-422F-B3C2-41B5E0EB22D1@jaguNET.com> <9EE59597-7931-484A-A61E-1A4715D9F5A3@c8h10n4o2.org.uk> <41F5D009-7C4E-47AB-8FE7-0B0C97E569FA@jaguNET.com> <569F4683.8020206@kippdata.de> <23C0818C-160A-4907-B574-B8853CF582A1@jaguNET.com> <91142A15-43F3-4AE2-8227-8866EA5F9DE4@jaguNET.com> <569FB1A8.9080208@kippdata.de> To: dev@httpd.apache.org X-Mailer: Apple Mail (2.3112) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1453307472; bh=FTF9ungcxCJ43tWJwUCJvqQPJ0xD8KXSFVA8ECVgk8Q=; h=Received:Received:Content-Type:Mime-Version:Subject:From:Date: Message-Id:To; b=hdSdygF0qk719yvCvQashg2yYX0GQ2Nd7+R35jIL/dJcHRRt7oCnmY92FmJp5oiuF /G3l2DYgSQ5NRplCUIaN+GPT1GA2Bb91Jq+Vlgmu3DtDdM0YRcgRogB/ZG+YQtLDQy TiynDyrcPpcJYHEKlOKZ7Nb7+vhYuGzUGeFSxO1uk7Gjhuyfm3HLFgn0lcCjwGyT7/ vAW1YaiZfR/Lq5FTw0fNeW7Q4eTcvww3vAhHIVaRUnyWwoNuyfD3voqPrKuHk7j+Uu jueHWE+y2sZoiGYoBaDTYrj2CuJLY1WylEzmmIbyo1K34K5/B87uzCax3JkbqKlnjD ptDqn3euTUhng== =46rom what I can see, this is the full patch required (minus docs): diff --git a/server/util_expr_eval.c b/server/util_expr_eval.c index 5a8f207..e97df88 100644 --- a/server/util_expr_eval.c +++ b/server/util_expr_eval.c @@ -1049,6 +1049,25 @@ static const char = *req_table_func(ap_expr_eval_ctx_t *ctx, const void *data, return apr_table_get(t, arg); } =20 +static const char *kb_func(ap_expr_eval_ctx_t *ctx, const void *data, + const char *arg) +{ + apr_off_t *length; + apr_status_t rv; + const char *buf; + + if (!ctx->r || !ctx->r->kept_body) + return ""; + + rv =3D apr_brigade_length(ctx->r->kept_body, 1, &length); + if (rv !=3D APR_SUCCESS || length =3D=3D 0) + return ""; + + buf =3D apr_palloc(ctx->r->pool, length+1); + apr_brigade_flatten(ctx->r->kept_body, buf, length); + return buf; +} + static const char *env_func(ap_expr_eval_ctx_t *ctx, const void *data, const char *arg) { @@ -1785,6 +1804,7 @@ static const struct expr_provider_single = string_func_providers[] =3D { { unbase64_func, "unbase64", NULL, 0 }, { sha1_func, "sha1", NULL, 0 }, { md5_func, "md5", NULL, 0 }, + { kb_func, "kept_body", NULL, 0 }, #if APR_VERSION_AT_LEAST(1,6,0) { ldap_func, "ldap", NULL, 0 }, #endif in other words, pretty brain dead easy... > On Jan 20, 2016, at 11:11 AM, Rainer Jung = wrote: >=20 > Am 20.01.2016 um 16:28 schrieb Jim Jagielski: >>=20 >>> On Jan 20, 2016, at 9:57 AM, Jim Jagielski wrote: >>>=20 >>> It would *REALLY* be nice if ap_expr was r->kept_body >>> aware. >>>=20 >>=20 >> Actually, that does NOT look that difficult... >>=20 >> Comments? Should I go for it? >=20 > No personal preference. The expression parser until now mostly is used = on the request side, so there's no immediate reuse of making it response = aware. So I'd decide on how much it distracts you from HC. Simply = implementing a dirty workaround for HC should be fine as well. Those = requests do not run with very high frequency (<< 100/s). >=20 > Regards, >=20 > Rainer >=20 >>> I could look at folding that in, but my goal is that all the >>> health-check stuff is 2.4-backport-able, and don't want to >>> hack ap_expr to allow that and have someone block that backport >>> due to, well... whatever. Some people just like blocking back- >>> ports, especially from people who's 1st and last names have the >>> same letters :) >>>=20 >>>> On Jan 20, 2016, at 8:08 AM, Jim Jagielski wrote: >>>>=20 >>>>>=20 >>>>> On Jan 20, 2016, at 7:59 AM, Jim Jagielski = wrote: >>>>>=20 >>>>>>=20 >>>>>> On Jan 20, 2016, at 3:34 AM, Rainer Jung = wrote: >>>>>>=20 >>>>>> Am 20.01.2016 um 01:57 schrieb Jim Jagielski: >>>>>>> Right now GET and CPING (as well as provider) is on my >>>>>>> TODO, in fact, they are currently set as "unimplemented" >>>>>>> although the hooks are there. >>>>>>>=20 >>>>>>> The main issue is that we need to worry about a (possibly) >>>>>>> large response body and some method of checking against >>>>>>> that. I have some ideas, but it's not as "easy" as it >>>>>>> was using ap_expr. >>>>>>=20 >>>>>> I wouldn't worry to much about the resource use in case of large = response bodies. As long as we warn in the docs. Most uses of this = advanced feature should end up using a special probing page in the = backend (application). GET instead of HEAD is nice though, because that = page can include some small status info which can be evaluated using the = expr. >>>>>>=20 >>>>>=20 >>>>> The only thing I can't figure out yet is that ap_expr doesn't >>>>> seem to be able to work on the response *body*, at least, >>>>> I haven't seen where it is able to do so. So I'll need to figure >>>>> out how to "trick" it to do so. >>>>=20 >>>> I guess I could shove the response body in the request note >>>> array... let me see.