You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Stefan Eissing <st...@greenbytes.de> on 2015/12/16 12:40:25 UTC

variables

I would like to expose some HTTP/2 properties, for example "HTTP2=on|off" similar to what mod_ssl does with HTTPS and other SSL variables. Current implementation does not look like something to repeat, at first glance, but maybe it's the only way...

The optional function ssl_is_https is used:
- from many modules
- server/util_expr_eval.c

The optional function ssl_var_lookup is used:
- from even more modules
- *not* in server

Subprocesses get their environment via r->subprocess_env, filled via the "fixups" hook. This is the usual way how we involve modules in request processing. But, as I read it, subprocess_env gets filled with all variables for every request, even though they maybe never read? Hmm, probably a little late to do anything about that without code breakage.

So, the least work and most 2.4.x compatible way for mod_http2 is to mimmic the mod_ssl way. http2_is_http2() and http2_var_lookup(), optional. Add fixups hook for subprocess_env, add $HTTP2 handling to server/util_expr_eval.c for checks in config/htaccess?

//Stefan

PS. For trunk, it might be a nice TODO to add a variable registry that allows lazy evaluation. Like with
  struct ap_var_handler_t {
    const char *name;
    const char *lookup(struct ap_var_handler_t *h, server_rec *s, conn_rec *c, request_rec *r);
    void *ctx;
    int server_specific :1;
    int conn_specific :1;
    int cacheable :1;
    int scope_config :1;
    int scope_subprocess :1;
  }






Re: variables

Posted by Stefan Eissing <st...@greenbytes.de>.
I would like these vars to behave like the HTTPS var does. There are two places
where these are made available:
1. ssl_engine_kernel: set in r->subprocess_env to "on" for https connections, otherwise left out
2. in util_expr_eval: as evaluation during config/htaccess expressions

HTTP2 has been implemented as in 1, I think. Part 2 is still missing. I put exported functions into mod_http2.h and added it to the include path just like mod_ssl does. If someone wants to add the util_expr_eval part, feel free. Currently busy with bugs... :(

Stefan

> Am 16.12.2015 um 19:39 schrieb William A Rowe Jr <wr...@rowe-clan.net>:
> 
> On Wed, Dec 16, 2015 at 5:40 AM, Stefan Eissing <st...@greenbytes.de> wrote:
> 
> Subprocesses get their environment via r->subprocess_env, filled via the "fixups" hook. This is the usual way how we involve modules in request processing. But, as I read it, subprocess_env gets filled with all variables for every request, even though they maybe never read? Hmm, probably a little late to do anything about that without code breakage.
> 
> Not 'all', that's what https://httpd.apache.org/docs/current/mod/mod_ssl.html#ssloptions
> overrides.  While the 'classic' http variables are a pretty short list, mod_ssl is
> capable of creating a very large list of variables, interesting to only a few cases.
> 
> HTTPS=on|off is always there, and HTTP2=on|off would be similarly helpful and
> very low impact.


Re: variables

Posted by William A Rowe Jr <wr...@rowe-clan.net>.
On Wed, Dec 16, 2015 at 5:40 AM, Stefan Eissing <
stefan.eissing@greenbytes.de> wrote:

>
> Subprocesses get their environment via r->subprocess_env, filled via the
> "fixups" hook. This is the usual way how we involve modules in request
> processing. But, as I read it, subprocess_env gets filled with all
> variables for every request, even though they maybe never read? Hmm,
> probably a little late to do anything about that without code breakage.
>

Not 'all', that's what
https://httpd.apache.org/docs/current/mod/mod_ssl.html#ssloptions
overrides.  While the 'classic' http variables are a pretty short list,
mod_ssl is
capable of creating a very large list of variables, interesting to only a
few cases.

HTTPS=on|off is always there, and HTTP2=on|off would be similarly helpful
and
very low impact.

Re: variables

Posted by Eric Covener <co...@gmail.com>.
On Wed, Dec 16, 2015 at 10:11 AM, Stefan Eissing
<st...@greenbytes.de> wrote:
> Not sure I understand. Isn't that what I said?


Sorry, missed it entirely. Read on phone and replied in browser.

Re: variables

Posted by Stefan Eissing <st...@greenbytes.de>.
> Am 16.12.2015 um 15:31 schrieb Eric Covener <co...@gmail.com>:
> 
> On Wed, Dec 16, 2015 at 6:40 AM, Stefan Eissing
> <st...@greenbytes.de> wrote:
>> So, the least work and most 2.4.x compatible way for mod_http2 is to mimmic the mod_ssl way. http2_is_http2() and http2_var_lookup(), optional. Add fixups hook for subprocess_env, add $HTTP2 handling to server/util_expr_eval.c for checks in config/htaccess?
> 
> I think you could (also) wrap them in server/util_expr_eval.c  to make
> them more accessible.

Not sure I understand. Isn't that what I said?

Re: variables

Posted by Eric Covener <co...@gmail.com>.
On Wed, Dec 16, 2015 at 6:40 AM, Stefan Eissing
<st...@greenbytes.de> wrote:
> So, the least work and most 2.4.x compatible way for mod_http2 is to mimmic the mod_ssl way. http2_is_http2() and http2_var_lookup(), optional. Add fixups hook for subprocess_env, add $HTTP2 handling to server/util_expr_eval.c for checks in config/htaccess?

I think you could (also) wrap them in server/util_expr_eval.c  to make
them more accessible.

-- 
Eric Covener
covener@gmail.com