Here's a slightly modified version of Joe's patch to - not segfault if rewrite_ssl_var_lookup is not available (mod_ssl not loaded) - use SSL environment variables as %{ENV:HTTPS} or %{ENV:SSL_PROTOCOL}
I tested the patch with the following rules, and it appeared to work without causing any problems. RewriteCond %{ENV:HTTPS} =on RewriteCond %{ENV:SSL_CIPHER_USEKEYSIZE} =128 RewriteRule ^/manual.*html$ /manual.html [L] RewriteRule ^.*$ - [F] -Madhu Index: mod_rewrite.c =================================================================== RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.c,v retrieving revision 1.252 diff -u -r1.252 mod_rewrite.c --- mod_rewrite.c 9 Feb 2004 20:29:20 -0000 1.252 +++ mod_rewrite.c 3 Mar 2004 22:59:07 -0000 @@ -380,6 +380,13 @@ static apr_global_mutex_t *rewrite_log_lock = NULL; #endif +/* support for ssl_var_lookup() */ +APR_DECLARE_OPTIONAL_FN(char *, ssl_var_lookup, + (apr_pool_t *, server_rec *, + conn_rec *, request_rec *, + char *)); +static APR_OPTIONAL_FN_TYPE(ssl_var_lookup) *rewrite_ssl_var_lookup = NULL; + /* * +-------------------------------------------------------+ @@ -1601,7 +1608,15 @@ if (var[3] == ':') { if (var[4] && !strncasecmp(var, "ENV", 3)) { var += 4; - result = apr_table_get(r->notes, var); + if (!strncasecmp(var, "SSL", 3) || !strncasecmp(var, "HTTPS", 5)) { + result = ((rewrite_ssl_var_lookup == NULL) || (r == NULL)) + ? (char *)NULL + : rewrite_ssl_var_lookup(r->pool, r->server, + r->connection, r, var); + } + else { + result = apr_table_get(r->notes, var); + } if (!result) { result = apr_table_get(r->subprocess_env, var); @@ -3995,6 +4010,8 @@ } } } + + rewrite_ssl_var_lookup = APR_RETRIEVE_OPTIONAL_FN(ssl_var_lookup); return OK; }