Well, mod_proxy_hcheck is actually abusing the r->kept_body brigade for its own uses. When we issue a GET for the health check, we simply copy the buckets from the response from the backend that comprises the body to r->kept_body. That way, ap_expr can now apply expressions against it to check if the backend is healthy or not.
It's totally self-contained. > On Jan 21, 2016, at 10:29 AM, Yann Ylavic <ylavic....@gmail.com> wrote: > > Is r->kept_body ever initiallized on the backend side, wouldn't > mod_proxy need to somehow add mod_request's filters? > > On Thu, Jan 21, 2016 at 4:25 PM, Jim Jagielski <j...@jagunet.com> wrote: >> Sounds good to me!! >> >> thx! >> >>> On Jan 21, 2016, at 10:23 AM, Rainer Jung <rainer.j...@kippdata.de> wrote: >>> >>> I should have asked earlier: wouldn't it be more suitable to implement to >>> response body as a variable instead of a function? >>> >>> When looking at server/util_expr_eval.c, I find request_var_names and >>> request_var_fn. The former is a list of variable names, and the latter >>> implements returning the values from parts of the request struct. Returning >>> the flattened kept_body should be a good fit there as well, without having >>> users wonder, why it is a function that requires an argument. >>> >>> If we expect further response stuff coming, we could also clone >>> request_var_names and request_var_fn with new response_var_names and >>> response_var_fn and add the variable as the first and currently only one >>> there. >>> >>> The variable name could be KEPT_BODY. >>> >>> WDYT? I can also do the little reorg, but which way do we prefer? >>> >>> Regards, >>> >>> Rainer >>> >>> Am 21.01.2016 um 14:54 schrieb j...@apache.org: >>>> Author: jim >>>> Date: Thu Jan 21 13:54:41 2016 >>>> New Revision: 1725949 >>>> >>>> URL: http://svn.apache.org/viewvc?rev=1725949&view=rev >>>> Log: >>>> Note that as a function, kept_body requires an argument, >>>> but the value of that argument is completely moot. >>>> >>>> Modified: >>>> httpd/httpd/trunk/docs/manual/expr.xml >>>> >>>> Modified: httpd/httpd/trunk/docs/manual/expr.xml >>>> URL: >>>> http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/expr.xml?rev=1725949&r1=1725948&r2=1725949&view=diff >>>> ============================================================================== >>>> --- httpd/httpd/trunk/docs/manual/expr.xml (original) >>>> +++ httpd/httpd/trunk/docs/manual/expr.xml Thu Jan 21 13:54:41 2016 >>>> @@ -502,7 +502,9 @@ listfunction ::= listfuncname "<strong>( >>>> <tr><td><code>note</code></td> >>>> <td>Lookup request note</td><td></td></tr> >>>> <tr><td><code>kept_body</code></td> >>>> - <td>Lookup response body if available in >>>> <code>r->kept_body</code></td><td></td></tr> >>>> + <td>Lookup response body if available in >>>> <code>r->kept_body</code>. <em>Note:</em> >>>> + function argument is required but ignored. >>>> + </td><td></td></tr> >>>> <tr><td><code>env</code></td> >>>> <td>Return first match of <code>note</code>, <code>reqenv</code>, >>>> <code>osenv</code></td><td></td></tr> >>