summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/lua/lua_request.c7
-rw-r--r--modules/lua/mod_lua.c7
-rw-r--r--modules/lua/mod_lua.h2
3 files changed, 16 insertions, 0 deletions
diff --git a/modules/lua/lua_request.c b/modules/lua/lua_request.c
index cc3837a46a..ffb3088650 100644
--- a/modules/lua/lua_request.c
+++ b/modules/lua/lua_request.c
@@ -358,6 +358,11 @@ static apr_table_t* req_notes(request_rec *r)
return r->notes;
}
+static int req_ssl_is_https_field(request_rec *r)
+{
+ return ap_lua_ssl_is_https(r->connection);
+}
+
/* END dispatch mathods for request_rec fields */
static int req_dispatch(lua_State *L)
@@ -645,6 +650,8 @@ AP_LUA_DECLARE(void) ap_lua_load_request_lmodule(lua_State *L, apr_pool_t *p)
makefun(&req_escape_html, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "ssl_var_lookup", APR_HASH_KEY_STRING,
makefun(&req_ssl_var_lookup, APL_REQ_FUNTYPE_LUACFUN, p));
+ apr_hash_set(dispatch, "is_https", APR_HASH_KEY_STRING,
+ makefun(&req_ssl_is_https_field, APL_REQ_FUNTYPE_BOOLEAN, p));
apr_hash_set(dispatch, "assbackwards", APR_HASH_KEY_STRING,
makefun(&req_assbackwards_field, APL_REQ_FUNTYPE_BOOLEAN, p));
apr_hash_set(dispatch, "status", APR_HASH_KEY_STRING,
diff --git a/modules/lua/mod_lua.c b/modules/lua/mod_lua.c
index 2535bd5fa3..d76afb6060 100644
--- a/modules/lua/mod_lua.c
+++ b/modules/lua/mod_lua.c
@@ -33,6 +33,7 @@ APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap_lua, AP_LUA, int, lua_request,
(lua_State *L, request_rec *r),
(L, r), OK, DECLINED)
static APR_OPTIONAL_FN_TYPE(ssl_var_lookup) *lua_ssl_val = NULL;
+static APR_OPTIONAL_FN_TYPE(ssl_is_https) *lua_ssl_is_https = NULL;
module AP_MODULE_DECLARE_DATA lua_module;
@@ -977,6 +978,11 @@ AP_LUA_DECLARE(const char *) ap_lua_ssl_val(apr_pool_t *p, server_rec *s, conn_r
return NULL;
}
+AP_LUA_DECLARE(int) ap_lua_ssl_is_https(conn_rec *c)
+{
+ return lua_ssl_is_https ? lua_ssl_is_https(c) : 0;
+}
+
/*******************************/
command_rec lua_commands[] = {
@@ -1114,6 +1120,7 @@ static int lua_post_config(apr_pool_t *pconf, apr_pool_t *plog,
apr_pool_t *ptemp, server_rec *s)
{
lua_ssl_val = APR_RETRIEVE_OPTIONAL_FN(ssl_var_lookup);
+ lua_ssl_is_https = APR_RETRIEVE_OPTIONAL_FN(ssl_is_https);
return OK;
}
diff --git a/modules/lua/mod_lua.h b/modules/lua/mod_lua.h
index d370b81f81..dcdb60154a 100644
--- a/modules/lua/mod_lua.h
+++ b/modules/lua/mod_lua.h
@@ -145,4 +145,6 @@ APR_DECLARE_EXTERNAL_HOOK(ap_lua, AP_LUA, int, lua_request,
AP_LUA_DECLARE(const char *) ap_lua_ssl_val(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r, const char *var);
+AP_LUA_DECLARE(int) ap_lua_ssl_is_https(conn_rec *c);
+
#endif /* !_MOD_LUA_H_ */