commit 51cea359faeed51f4565d107aa2d55282f87e135
Date: Mon Mar 20 19:29:08 2017 +0800
Added request_location in nginx variables.
diff --git a/src/http/ngx_http_variables.c
b/src/http/ngx_http_variables.c
index f8271ab6..dadda696 100644
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -74,6 +74,8 @@ static ngx_int_t
ngx_http_variable_document_root(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t
ngx_http_variable_realpath_root(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t
ngx_http_variable_request_location(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t
ngx_http_variable_request_filename(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t
ngx_http_variable_server_name(ngx_http_request_t *r,
@@ -222,6 +224,9 @@ static ngx_http_variable_t
ngx_http_core_variables[] = {
{ ngx_string("realpath_root"), NULL,
ngx_http_variable_realpath_root, 0,
NGX_HTTP_VAR_NOCACHEABLE, 0 },
+ { ngx_string("request_location"), NULL,
+ ngx_http_variable_request_location, 0,
NGX_HTTP_VAR_NOCACHEABLE, 0 },
+
{ ngx_string("query_string"), NULL,
ngx_http_variable_request,
offsetof(ngx_http_request_t, args),
NGX_HTTP_VAR_NOCACHEABLE, 0 },
@@ -1531,6 +1536,24 @@
ngx_http_variable_realpath_root(ngx_http_request_t *r,
static ngx_int_t
+ngx_http_variable_request_location(ngx_http_request_t
*r,
+ ngx_http_variable_value_t *v, uintptr_t data)
+{
+ ngx_http_core_loc_conf_t *clcf;
+
+ clcf = ngx_http_get_module_loc_conf(r,
ngx_http_core_module);
+
+ v->len = clcf->name.len;
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
+ v->data = "">
+
+ return NGX_OK;
+}
+
+
+static ngx_int_t
ngx_http_variable_request_filename(ngx_http_request_t
*r,
ngx_http_variable_value_t *v, uintptr_t data)
{
```