diff options
author | Madhusudan Mathihalli <madhum@apache.org> | 2004-03-09 18:33:15 +0100 |
---|---|---|
committer | Madhusudan Mathihalli <madhum@apache.org> | 2004-03-09 18:33:15 +0100 |
commit | bc33efe94ab4b5ce006753362febf55206c86d5b (patch) | |
tree | a6d6e8c8c41ce2220bf58aa2c315c1b5c3c79103 /modules | |
parent | Sync with 2.0.49 tag. (diff) | |
download | apache2-bc33efe94ab4b5ce006753362febf55206c86d5b.tar.xz apache2-bc33efe94ab4b5ce006753362febf55206c86d5b.zip |
Enable mod_rewrite to recognize SSL variables (using ssl_var_lookup)
Submitted by: Joe Orton
Reviewed by: Madhusudan Mathihalli
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102904 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules')
-rw-r--r-- | modules/mappers/mod_rewrite.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 94ef586bc3..15976223c4 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -89,6 +89,8 @@ #include "http_protocol.h" #include "http_vhost.h" +#include "mod_ssl.h" + #include "mod_rewrite.h" #if !defined(OS2) && !defined(WIN32) && !defined(BEOS) && !defined(NETWARE) @@ -380,6 +382,9 @@ static apr_global_mutex_t *rewrite_mapr_lock_acquire = NULL; static apr_global_mutex_t *rewrite_log_lock = NULL; #endif +/* Optional functions imported from mod_ssl when loaded: */ +static APR_OPTIONAL_FN_TYPE(ssl_var_lookup) *rewrite_ssl_lookup = NULL; +static APR_OPTIONAL_FN_TYPE(ssl_is_https) *rewrite_is_https = NULL; /* * +-------------------------------------------------------+ @@ -1610,6 +1615,10 @@ static char *lookup_variable(char *var, rewrite_ctx *ctx) result = getenv(var); } } + else if (var[4] && !strncasecmp(var, "SSL", 3) && rewrite_ssl_lookup) { + result = rewrite_ssl_lookup(r->pool, r->server, r->connection, r, + var + 4); + } } else if (var[4] == ':') { if (var[5]) { @@ -1693,6 +1702,13 @@ static char *lookup_variable(char *var, rewrite_ctx *ctx) return (char *)result; } break; + + case 5: + if (!strcmp(var, "HTTPS")) { + int flag = rewrite_is_https && rewrite_is_https(r->connection); + return apr_pstrdup(r->pool, flag ? "on" : "off"); + } + break; case 8: switch (var[6]) { @@ -3996,6 +4012,9 @@ static int post_config(apr_pool_t *p, } } + rewrite_ssl_lookup = APR_RETRIEVE_OPTIONAL_FN(ssl_var_lookup); + rewrite_is_https = APR_RETRIEVE_OPTIONAL_FN(ssl_is_https); + return OK; } |